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
Modifier and TypeClassDescriptionstatic enum
static enum
static enum
Nested classes/interfaces inherited from interface liquibase.serializer.LiquibaseSerializable
LiquibaseSerializable.SerializationType
-
Field Summary
Fields inherited from interface liquibase.serializer.LiquibaseSerializable
GENERIC_CHANGELOG_EXTENSION_NAMESPACE, GENERIC_SNAPSHOT_EXTENSION_NAMESPACE, STANDARD_CHANGELOG_NAMESPACE, STANDARD_SNAPSHOT_NAMESPACE
-
Constructor Summary
ConstructorDescriptionChangeSet
(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 TypeMethodDescriptionvoid
void
void
addRollbackChange
(Change change) void
addRollBackSQL
(String sql) void
addSqlVisitor
(SqlVisitor sqlVisitor) void
addValidCheckSum
(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 labelsvoid
boolean
execute
(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.getId()
Returns the logical file path defined directly on this node.getSerializableFieldType
(String field) getSerializableFieldValue
(String field) Gets storedCheckSumprotected void
handleChildNode
(ParsedNode child, ResourceAccessor resourceAccessor) protected void
handleRollbackNode
(ParsedNode rollbackNode, ResourceAccessor resourceAccessor) boolean
Returns whether custom rollback steps are specified for this changeSet, or whether auto-generated ones should be usedint
hashCode()
boolean
boolean
isCheckSumValid
(CheckSum storedCheckSum) boolean
isIgnore()
boolean
boolean
boolean
void
load
(ParsedNode node, ResourceAccessor resourceAccessor) static String
lookupExecutor
(String executorName) Look for a configuration property that matches liquibase..executor and if found, return its value as the executor name void
removeAllChanges
(Collection<?> collection) Method created to remove changes from a changesetvoid
void
rollback
(Database database, ChangeExecListener listener) setAttribute
(String attribute, Object value) void
setChangeLogParameters
(ChangeLogParameters changeLogParameters) Called by the changelog parsing process to pass theChangeLogParameters
.void
setComments
(String comments) setContextFilter
(ContextExpression contextFilter) setContexts
(ContextExpression contexts) Deprecated.protected void
void
setDeploymentId
(String deploymentId) void
setFailOnError
(Boolean failOnError) void
setFilePath
(String filePath) Called to update file path from database entry when rolling back and ignoreClasspathPrefix is true.void
setIgnore
(boolean ignore) void
void
setLogicalFilePath
(String logicalFilePath) void
setOnValidationFail
(ChangeSet.ValidationFailOption onValidationFail) void
setPreconditions
(PreconditionContainer preconditionContainer) void
setRunOrder
(String runOrder) void
setRunWith
(String runWith) void
setRunWithSpoolFile
(String runWithSpoolFile) void
setStoredCheckSum
(CheckSum storedCheckSum) Sets the stored checksum in the ValidatingVisitor in case the changeset was executed.void
setStoredFilePath
(String storedFilePath) void
setValidationFailed
(boolean validationFailed) boolean
boolean
boolean
supportsRollback
(Database database) protected Change
toChange
(ParsedNode value, ResourceAccessor resourceAccessor) toString()
toString
(boolean includeMD5Sum)
-
Field Details
-
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. Returnsnull
if not set.- Returns:
- the logical file path defined on this node, or
null
if 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:
load
in 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:
serialize
in 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:
getPreconditions
in interfaceConditional
-
setPreconditions
- Specified by:
setPreconditions
in 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:
getSerializedObjectName
in interfaceLiquibaseSerializable
-
getSerializableFields
- Specified by:
getSerializableFields
in interfaceLiquibaseSerializable
-
getSerializableFieldValue
- Specified by:
getSerializableFieldValue
in interfaceLiquibaseSerializable
-
getSerializableFieldType
- Specified by:
getSerializableFieldType
in interfaceLiquibaseSerializable
-
getSerializedObjectNamespace
- Specified by:
getSerializedObjectNamespace
in interfaceLiquibaseSerializable
-
getSerializableFieldNamespace
- Specified by:
getSerializableFieldNamespace
in 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()
-
getContextFilter()