Package liquibase.changelog
Class ChangeSet
java.lang.Object
liquibase.changelog.ChangeSet
- All Implemented Interfaces:
ChangeLogChild,Conditional,LiquibaseSerializable
Encapsulates a changeSet and all its associated changes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumstatic enumNested classes/interfaces inherited from interface liquibase.serializer.LiquibaseSerializable
LiquibaseSerializable.SerializationType -
Field Summary
FieldsFields inherited from interface liquibase.serializer.LiquibaseSerializable
GENERIC_CHANGELOG_EXTENSION_NAMESPACE, GENERIC_SNAPSHOT_EXTENSION_NAMESPACE, STANDARD_CHANGELOG_NAMESPACE, STANDARD_SNAPSHOT_NAMESPACE -
Constructor Summary
ConstructorsConstructorDescriptionChangeSet(String id, String author, boolean alwaysRun, boolean runOnChange, String filePath, String contextFilter, String dbmsList, boolean runInTransaction, DatabaseChangeLog databaseChangeLog) ChangeSet(String id, String author, boolean alwaysRun, boolean runOnChange, String filePath, String contextFilter, String dbmsList, boolean runInTransaction, ObjectQuotingStrategy quotingStrategy, DatabaseChangeLog databaseChangeLog) ChangeSet(String id, String author, boolean alwaysRun, boolean runOnChange, String filePath, String contextFilter, String dbmsList, String runWith, String runWithSpoolFile, boolean runInTransaction, ObjectQuotingStrategy quotingStrategy, DatabaseChangeLog databaseChangeLog) ChangeSet(String id, String author, boolean alwaysRun, boolean runOnChange, String filePath, String contextFilter, String dbmsList, DatabaseChangeLog databaseChangeLog) ChangeSet(String id, String author, boolean alwaysRun, boolean runOnChange, String filePath, String contextFilter, String dbmsList, ObjectQuotingStrategy quotingStrategy, DatabaseChangeLog databaseChangeLog) ChangeSet(DatabaseChangeLog databaseChangeLog) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidaddRollbackChange(Change change) voidaddRollBackSQL(String sql) voidaddSqlVisitor(SqlVisitor sqlVisitor) voidaddValidCheckSum(String text) Build and return a string which contains both the changeset and inherited contextBuild and return a string which contains both the changeset and inherited labelsvoidbooleanexecute(DatabaseChangeLog databaseChangeLog, ChangeExecListener listener, Database database) This method will actually execute each of the changes in the list against the specified database.execute(DatabaseChangeLog databaseChangeLog, Database database) generateCheckSum(ChecksumVersion version) getAttribute(String attribute) Returns an unmodifiable list of changes.Deprecated.longgetId()Returns the logical file path defined directly on this node.getSerializableFieldType(String field) getSerializableFieldValue(String field) Gets storedCheckSumprotected voidhandleChildNode(ParsedNode child, ResourceAccessor resourceAccessor) protected voidhandleRollbackNode(ParsedNode rollbackNode, ResourceAccessor resourceAccessor) booleanReturns whether custom rollback steps are specified for this changeSet, or whether auto-generated ones should be usedinthashCode()booleanbooleanisCheckSumValid(CheckSum storedCheckSum) booleanisIgnore()booleanbooleanbooleanvoidload(ParsedNode node, ResourceAccessor resourceAccessor) static StringlookupExecutor(String executorName) Look for a configuration property that matches liquibase..executor and if found, return its value as the executor name voidremoveAllChanges(Collection<?> collection) Method created to remove changes from a changesetvoidvoidrollback(Database database, ChangeExecListener listener) setAttribute(String attribute, Object value) voidsetChangeLogParameters(ChangeLogParameters changeLogParameters) Called by the changelog parsing process to pass theChangeLogParameters.voidsetComments(String comments) setContextFilter(ContextExpression contextFilter) setContexts(ContextExpression contexts) Deprecated.protected voidvoidsetDeploymentId(String deploymentId) voidsetFailOnError(Boolean failOnError) voidsetFilePath(String filePath) Called to update file path from database entry when rolling back and ignoreClasspathPrefix is true.voidsetIgnore(boolean ignore) voidvoidsetLogicalFilePath(String logicalFilePath) voidsetOnValidationFail(ChangeSet.ValidationFailOption onValidationFail) voidsetPreconditions(PreconditionContainer preconditionContainer) voidsetRunOrder(String runOrder) voidsetRunWith(String runWith) voidsetRunWithSpoolFile(String runWithSpoolFile) voidsetStoredCheckSum(CheckSum storedCheckSum) Sets the stored checksum in the ValidatingVisitor in case the changeset was executed.voidsetStoredFilePath(String storedFilePath) voidsetValidationFailed(boolean validationFailed) booleanbooleanbooleansupportsRollback(Database database) protected ChangetoChange(ParsedNode value, ResourceAccessor resourceAccessor) toString()toString(boolean includeMD5Sum)
-
Field Details
-
CHANGE_KEY
- See Also:
-
checkSum
-
key
-
-
Constructor Details
-
ChangeSet
-
ChangeSet
-
ChangeSet
-
ChangeSet
public ChangeSet(String id, String author, boolean alwaysRun, boolean runOnChange, String filePath, String contextFilter, String dbmsList, ObjectQuotingStrategy quotingStrategy, DatabaseChangeLog databaseChangeLog) -
ChangeSet
public ChangeSet(String id, String author, boolean alwaysRun, boolean runOnChange, String filePath, String contextFilter, String dbmsList, boolean runInTransaction, ObjectQuotingStrategy quotingStrategy, DatabaseChangeLog databaseChangeLog) -
ChangeSet
public ChangeSet(String id, String author, boolean alwaysRun, boolean runOnChange, String filePath, String contextFilter, String dbmsList, String runWith, String runWithSpoolFile, boolean runInTransaction, ObjectQuotingStrategy quotingStrategy, DatabaseChangeLog databaseChangeLog)
-
-
Method Details
-
shouldAlwaysRun
public boolean shouldAlwaysRun() -
shouldRunOnChange
public boolean shouldRunOnChange() -
setDbms
-
getFilePath
- Returns:
- either this object's logicalFilePath or the changelog's filepath (logical or physical) if not.
-
getLogicalFilePath
Returns the logical file path defined directly on this node. Returnsnullif not set.- Returns:
- the logical file path defined on this node, or
nullif not set
-
setLogicalFilePath
-
getStoredFilePath
-
setStoredFilePath
-
getRunWith
- Returns:
- the runWith value. If the runWith value is empty or not set this method will return null.
-
setRunWith
-
getRunWithSpoolFile
-
setRunWithSpoolFile
-
clearCheckSum
public void clearCheckSum() -
generateCheckSum
-
load
- Specified by:
loadin interfaceLiquibaseSerializable- Throws:
ParsedNodeException
-
handleChildNode
protected void handleChildNode(ParsedNode child, ResourceAccessor resourceAccessor) throws ParsedNodeException - Throws:
ParsedNodeException
-
handleRollbackNode
protected void handleRollbackNode(ParsedNode rollbackNode, ResourceAccessor resourceAccessor) throws ParsedNodeException - Throws:
ParsedNodeException
-
toChange
protected Change toChange(ParsedNode value, ResourceAccessor resourceAccessor) throws ParsedNodeException - Throws:
ParsedNodeException
-
serialize
- Specified by:
serializein interfaceLiquibaseSerializable
-
execute
public ChangeSet.ExecType execute(DatabaseChangeLog databaseChangeLog, Database database) throws MigrationFailedException - Throws:
MigrationFailedException
-
execute
public ChangeSet.ExecType execute(DatabaseChangeLog databaseChangeLog, ChangeExecListener listener, Database database) throws MigrationFailedException This method will actually execute each of the changes in the list against the specified database.- Returns:
- should changeset be marked as ran
- Throws:
MigrationFailedException
-
lookupExecutor
Look for a configuration property that matches liquibase..executor and if found, return its value as the executor name - Parameters:
executorName- The value from the input changeset runWith attribute- Returns:
- String The mapped value
-
rollback
- Throws:
RollbackFailedException
-
rollback
- Throws:
RollbackFailedException
-
hasCustomRollbackChanges
public boolean hasCustomRollbackChanges()Returns whether custom rollback steps are specified for this changeSet, or whether auto-generated ones should be used -
getChanges
Returns an unmodifiable list of changes. To add one, use the addRefactoring method. -
removeAllChanges
Method created to remove changes from a changeset- Parameters:
collection-
-
addChange
-
getId
-
getAuthor
-
getContexts
Deprecated. -
setContexts
Deprecated. -
getContextFilter
-
setContextFilter
-
getLabels
-
setLabels
-
getDbmsSet
-
isIgnore
public boolean isIgnore() -
setIgnore
public void setIgnore(boolean ignore) -
isInheritableIgnore
public boolean isInheritableIgnore() -
getInheritableContextFilter
-
getInheritableLabels
-
buildFullContext
Build and return a string which contains both the changeset and inherited context- Returns:
- String
-
buildFullLabels
Build and return a string which contains both the changeset and inherited labels- Returns:
- String
-
getChangeLog
-
toString
-
toNormalizedString
-
toString
-
getComments
-
setComments
-
isAlwaysRun
public boolean isAlwaysRun() -
isRunOnChange
public boolean isRunOnChange() -
isRunInTransaction
public boolean isRunInTransaction() -
getRollback
-
addRollBackSQL
-
addRollbackChange
-
supportsRollback
-
getDescription
-
getFailOnError
-
setFailOnError
-
getOnValidationFail
-
setOnValidationFail
-
setValidationFailed
public void setValidationFailed(boolean validationFailed) -
addValidCheckSum
-
getValidCheckSums
-
isCheckSumValid
-
getPreconditions
- Specified by:
getPreconditionsin interfaceConditional
-
setPreconditions
- Specified by:
setPreconditionsin interfaceConditional
-
addSqlVisitor
-
getSqlVisitors
-
getChangeLogParameters
-
setChangeLogParameters
Called by the changelog parsing process to pass theChangeLogParameters. -
setFilePath
Called to update file path from database entry when rolling back and ignoreClasspathPrefix is true. -
setRunOrder
-
getSerializedObjectName
- Specified by:
getSerializedObjectNamein interfaceLiquibaseSerializable
-
getSerializableFields
- Specified by:
getSerializableFieldsin interfaceLiquibaseSerializable
-
getSerializableFieldValue
- Specified by:
getSerializableFieldValuein interfaceLiquibaseSerializable
-
getSerializableFieldType
- Specified by:
getSerializableFieldTypein interfaceLiquibaseSerializable
-
getSerializedObjectNamespace
- Specified by:
getSerializedObjectNamespacein interfaceLiquibaseSerializable
-
getSerializableFieldNamespace
- Specified by:
getSerializableFieldNamespacein interfaceLiquibaseSerializable
-
equals
-
hashCode
public int hashCode() -
getAttribute
-
setAttribute
-
getStoredCheckSum
Gets storedCheckSum- Returns:
- storedCheckSum if it was executed otherwise null
-
setStoredCheckSum
Sets the stored checksum in the ValidatingVisitor in case the changeset was executed.- Parameters:
storedCheckSum- the checksum to set
-
getDeploymentId
- Returns:
- Deployment ID stored in the databasechangelog table.
-
setDeploymentId
- Parameters:
deploymentId- Deployment ID stored in the databasechangelog table.
-
addChangeSetMdcProperties
public void addChangeSetMdcProperties() -
getExecutionMilliseconds
public long getExecutionMilliseconds()
-
getContextFilter()