Top Description Inners Fields Constructors Methods
liquibase.changelog

public Class ChangeSet

extends Object
implements Conditional, ChangeLogChild
Class Inheritance
All Implemented Interfaces
liquibase.changelog.ChangeLogChild, liquibase.serializer.LiquibaseSerializable, liquibase.precondition.Conditional
Imports
liquibase.ChecksumVersion, .ContextExpression, .Labels, .Scope, liquibase.change.*, liquibase.change.core.EmptyChange, .RawSQLChange, .SQLFileChange, liquibase.change.visitor.ChangeVisitor, liquibase.changelog.visitor.ChangeExecListener, liquibase.configuration.LiquibaseConfiguration, liquibase.database.Database, .DatabaseList, .ObjectQuotingStrategy, liquibase.exception.*, liquibase.executor.Executor, .ExecutorService, .LoggingExecutor, liquibase.logging.Logger, liquibase.logging.mdc.MdcKey, liquibase.logging.mdc.customobjects.RollbackSqlFile, liquibase.parser.ChangeLogParserConfiguration, liquibase.parser.core.ParsedNode, .ParsedNodeException, liquibase.precondition.Conditional, .ErrorPrecondition, .FailedPrecondition, liquibase.precondition.core.PreconditionContainer, liquibase.resource.ResourceAccessor, liquibase.sql.visitor.SqlVisitor, .SqlVisitorFactory, liquibase.sqlgenerator.SqlGeneratorFactory, liquibase.statement.SqlStatement, liquibase.util.SqlUtil, .StreamUtil, .StringUtil, lombok.Getter, lombok.Setter, java.time.Instant, java.util.*, java.util.concurrent.atomic.AtomicReference, java.util.stream.Collectors

Encapsulates a changeSet and all its associated changes.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
public static enum
public static enum

Field Summary

Modifier and TypeField and Description
private boolean
alwaysRun

If set to true, the changeSet will be executed on every update.

private static final String
private final Map<String, Object>
private String
author

"author" defined in changeLog file.

private final DatabaseChangeLog
private ChangeLogParameters
private final List<Change>
changes

List of change objects defined in this changeset

protected CheckSum
private static final String
private static final String
private String
comments

ChangeSet comments defined in changeLog file

private ContextExpression
contextFilter

Runtime contexts in which the changeSet will be executed.

private String
private Set<String>
dbmsSet

Databases for which this changeset should run.

private String
deploymentId

Deployment ID stored in the databasechangelog table.

private String
private ChangeSet.ExecType
private Boolean
failOnError

If false, do not stop liquibase update execution if an error is thrown executing the changeSet.

private String
filePath

File changeSet is defined in. May be a logical/non-physical string.

private List<String>
private String
id

"id" specified in changeLog file.

private boolean
ignore

If set to true, the changeSet will be ignored (skipped)

protected String
private Labels
labels

"Labels" associated with this changeSet.

private String
logicalFilePath

A logicalFilePath if defined

private ObjectQuotingStrategy
private ChangeSet.ValidationFailOption
onValidationFail

Behavior if the validation of any of the changeSet changes fails.

private static final String
private PreconditionContainer
preconditions

ChangeSet level preconditions defined for this changeSet

private final RollbackContainer
rollback

Changes defined to roll back this changeSet

private ChangeSet.ExecType
private boolean
runInTransaction

If true, the changeSet will run in a database transaction.

private boolean
runOnChange

If set to true, the changeSet will be executed when the checksum changes.

private String
runOrder

Allow changeSet to be ran "first" or "last".

private String
runWith

ChangeSet level attribute to specify an Executor

private String
runWithSpoolFile

ChangeSet level attribute to specify a spool file name

private final List<SqlVisitor>
sqlVisitors

SqlVisitors defined for this changeset.

private CheckSum
storedCheckSum

storedChecksum is used to make the checksum of a changeset that has already been run on a database available to liquibase extensions.

private String
storedFilePath

File path stored in the databasechangelog table.

private boolean
validationFailed

Stores if validation failed on this ChangeSet

private final Set<CheckSum>
validCheckSums

List of checksums that are assumed to be valid besides the one stored in the database.

private static final String

Constructor Summary

AccessConstructor and Description
public
ChangeSet(DatabaseChangeLog databaseChangeLog)

public
ChangeSet(String id, String author, boolean alwaysRun, boolean runOnChange, String filePath, String contextFilter, String dbmsList, DatabaseChangeLog databaseChangeLog)

public
ChangeSet(String id, String author, boolean alwaysRun, boolean runOnChange, String filePath, String contextFilter, String dbmsList, boolean runInTransaction, DatabaseChangeLog databaseChangeLog)

public
ChangeSet(String id, String author, boolean alwaysRun, boolean runOnChange, String filePath, String contextFilter, String dbmsList, ObjectQuotingStrategy quotingStrategy, DatabaseChangeLog databaseChangeLog)

public
ChangeSet(String id, String author, boolean alwaysRun, boolean runOnChange, String filePath, String contextFilter, String dbmsList, boolean runInTransaction, ObjectQuotingStrategy quotingStrategy, DatabaseChangeLog databaseChangeLog)

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 Summary

Modifier and TypeMethod and Description
public void
addChange(Change change)

public void
public void
public void
private void
private String
addSqlMdc(Change
the change to read sql from
change
,
Database
the database to generate change sql against
database
,
boolean
controls generation of rollback sql statements or standard statements sql
generateRollbackStatements
)

Adds changeset sql to mdc if the change is supported by the database

public void
public void
private void
appendContext(StringBuilder contextExpression, String contextToAppend, boolean notFirstContext)

private void
appendLabels(StringBuilder existingLabels, String labelToAppend, boolean notFirstContext)

public String

Returns:

String
buildFullContext
()

Build and return a string which contains both the changeset and inherited context

public String

Returns:

String
buildFullLabels
()

Build and return a string which contains both the changeset and inherited labels

public void
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public ChangeSet.ExecType
execute(DatabaseChangeLog databaseChangeLog, Database database)

public ChangeSet.ExecType

Returns:

should changeset be marked as ran
execute
(DatabaseChangeLog databaseChangeLog, ChangeExecListener listener, Database database)

This method will actually execute each of the changes in the list against the specified database.

public CheckSum
public Object
getAttribute(String attribute)

public String
public DatabaseChangeLog
public ChangeLogParameters
public List<Change>
getChanges()

Returns an unmodifiable list of changes.

private List<ChangeVisitor>
public String
public ContextExpression
public ContextExpression
public String
public Set<String>
public String

Returns:

Deployment ID stored in the databasechangelog table.
getDeploymentId
()

public String
public Boolean
public String

Returns:

either this object's logicalFilePath or the changelog's filepath (logical or physical) if not.
getFilePath
()

public String
public Collection<ContextExpression>
public Collection<Labels>
public Labels
public String

Returns:

the logical file path defined on this node, or null if not set
getLogicalFilePath
()

Returns the logical file path defined directly on this node.

public ObjectQuotingStrategy
public ChangeSet.ValidationFailOption
public PreconditionContainer
public RollbackContainer
public String
public String

Returns:

the runWith value. If the runWith value is empty or not set this method will return null.
getRunWith
()

public String
public String
public Set<String>
public LiquibaseSerializable.SerializationType
public Object
public String
public String
public List<SqlVisitor>
public CheckSum

Returns:

storedCheckSum if it was executed otherwise null
getStoredCheckSum
()

Gets storedCheckSum

public String
public Set<CheckSum>
protected void
handleChildNode(ParsedNode child, ResourceAccessor resourceAccessor)

protected void
handleRollbackNode(ParsedNode rollbackNode, ResourceAccessor resourceAccessor)

public boolean
hasCustomRollbackChanges()

Returns whether custom rollback steps are specified for this changeSet, or whether auto-generated ones should be used

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

private boolean
public boolean
public boolean
isCheckSumValid(CheckSum storedCheckSum)

public boolean
public boolean
public boolean
public boolean
public void
public static String

Returns:

String The mapped value
lookupExecutor
(String
The value from the input changeset runWith attribute
executorName
)

Look for a configuration property that matches liquibase.

public void
removeAllChanges(Collection<?> collection)

Method created to remove changes from a changeset

public void
rollback(Database database)

public void
rollback(Database database, ChangeExecListener listener)

public ParsedNode
public ChangeSet
setAttribute(String attribute, Object value)

public void
setChangeLogParameters(ChangeLogParameters changeLogParameters)

Called by the changelog parsing process to pass the ChangeLogParameters.

public void
setComments(String comments)

public ChangeSet
public ChangeSet
public void
setCreated(String created)

protected void
setDbms(String dbmsList)

public void
setDeploymentId(String
Deployment ID stored in the databasechangelog table.
deploymentId
)

public void
setFailOnError(Boolean failOnError)

public void
setFilePath(String filePath)

Called to update file path from database entry when rolling back and ignoreClasspathPrefix is true.

public void
setIgnore(boolean ignore)

public void
setLabels(Labels labels)

public void
setLogicalFilePath(String logicalFilePath)

public void
public void
public void
setRunOrder(String runOrder)

public void
setRunWith(String runWith)

public void
setRunWithSpoolFile(String runWithSpoolFile)

public void
setStoredCheckSum(CheckSum
the checksum to set
storedCheckSum
)

Sets the stored checksum in the ValidatingVisitor in case the changeset was executed.

public void
setStoredFilePath(String storedFilePath)

private Executor
public void
setValidationFailed(boolean validationFailed)

public boolean
public boolean
public boolean
protected Change
toChange(ParsedNode value, ResourceAccessor resourceAccessor)

public String
public String
toString(boolean includeMD5Sum)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait