Top Description Fields Methods
liquibase.change

public Interface Change

extends LiquibaseSerializable, Plugin, ExtensibleObject
Known Direct Implementers
liquibase.change.AbstractChange
Imports
liquibase.ExtensibleObject, .Scope, liquibase.change.visitor.ChangeVisitor, liquibase.changelog.ChangeSet, liquibase.database.Database, liquibase.exception.RollbackImpossibleException, .SetupException, .ValidationErrors, .Warnings, liquibase.parser.core.ParsedNodeException, liquibase.plugin.Plugin, liquibase.resource.ResourceAccessor, liquibase.serializer.LiquibaseSerializable, liquibase.statement.SqlStatement, liquibase.structure.DatabaseObject, java.util.Set

Interface all changes (refactorings) implement.

Instances of these objects are normally created via the ChangeFactory by liquibase.parser.ChangeLogParser implementations.

See Also
ChangeFactory, Database

Field Summary

Modifier and TypeField and Description
public static final Change[]
EMPTY_CHANGE

Represent an empty array of Change

public static final String
Inherited from liquibase.plugin.Plugin:
PRIORITY_DATABASEPRIORITY_DEFAULTPRIORITY_NOT_APPLICABLEPRIORITY_SPECIALIZED
Inherited from liquibase.serializer.LiquibaseSerializable:
GENERIC_CHANGELOG_EXTENSION_NAMESPACEGENERIC_SNAPSHOT_EXTENSION_NAMESPACESTANDARD_CHANGELOG_NAMESPACESTANDARD_SNAPSHOT_NAMESPACE

Method Summary

Modifier and TypeMethod and Description
public ChangeStatus
checkStatus(Database database)

Validate that this change executed successfully against the given database.

public ChangeMetaData
public void
finishInitialization()

This method will be called by the changelog parsing process after all of the properties have been set to allow the task to do any additional initialization logic.

public CheckSum
generateCheckSum()

Calculates the checksum of this Change based on the current configuration.

public SqlStatement[]
generateRollbackStatements(Database database)

Generates the SqlStatement objects that would roll back the change.

public boolean
generateRollbackStatementsVolatile(Database database)

Returns true if this change reads data from the database or other sources that would change during the course of an update in the generateRollbackStatements(Database) method.

public SqlStatement[]
generateStatements(Database database)

Generates the SqlStatement objects required to run the change for the given database.

public boolean
generateStatementsVolatile(Database database)

Returns true if this change reads data from the database or other sources that would change during the course of an update in the generateStatements(Database) method.

public Set<DatabaseObject>
getAffectedDatabaseObjects(Database database)

Returns example DatabaseObject instances describing the objects affected by this change.

public ChangeSet
getChangeSet()

Returns the changeSet this Change is part of.

public String
getConfirmationMessage()

Confirmation message to be displayed after the change is executed.

public String
getDescription()

Short, scannable description for the DATABASECHANGELOG.DESCRIPTION column

public void
modify(ChangeVisitor changeVisitor)

public void
setChangeSet(ChangeSet changeSet)

Sets the changeSet this Change is a part of.

public void
setResourceAccessor(ResourceAccessor resourceAccessor)
Deprecated this is now set via Scope

Sets the ResourceAccessor that should be used for any file and/or resource loading needed by this Change.

public boolean
supports(Database database)

Return true if this Change object supports the passed database.

public boolean
supportsRollback(Database database)

Returns true if this can change be rolled back for the given database.

public ValidationErrors
validate(Database database)

Generate errors based on the configured Change instance.

public Warnings
warn(Database database)

Generates warnings based on the configured Change instance.

Inherited from liquibase.ExtensibleObject:
clonedescribegetgetgetAttributesgetObjectMetaDatagetValuePathhasset
Inherited from liquibase.serializer.LiquibaseSerializable:
getSerializableFieldNamespacegetSerializableFieldsgetSerializableFieldTypegetSerializableFieldValuegetSerializedObjectNamegetSerializedObjectNamespaceloadserialize

Field Detail

EMPTY_CHANGEback to summary
public static final Change[] EMPTY_CHANGE

Represent an empty array of Change

SHOULD_EXECUTEback to summary
public static final String SHOULD_EXECUTE

Method Detail

checkStatusback to summary
public ChangeStatus checkStatus(Database database)

Validate that this change executed successfully against the given database. This will check that the update completed at a high level plus check details of the change. For example, a change to add a column will check that the column exists plus data type, default values, etc.

createChangeMetaDataback to summary
public ChangeMetaData createChangeMetaData()
finishInitializationback to summary
public void finishInitialization() throws SetupException

This method will be called by the changelog parsing process after all of the properties have been set to allow the task to do any additional initialization logic.

generateCheckSumback to summary
public CheckSum generateCheckSum()

Calculates the checksum of this Change based on the current configuration. The checksum should take into account all settings that would impact what actually happens to the database and NOT include any settings that do not impact the actual execution of the change.

generateRollbackStatementsback to summary
public SqlStatement[] generateRollbackStatements(Database database) throws RollbackImpossibleException

Generates the SqlStatement objects that would roll back the change.

NOTE: This method may be called multiple times throughout the changelog execution process and may be called in documentation generation and other integration points as well.

If this method reads from the current database state or uses any other logic that will be affected by whether previous changeSets have been rolled back or not, you must return true from generateRollbackStatementsVolatile.
Exceptions
RollbackImpossibleException:
if rollback is not supported for this change
generateRollbackStatementsVolatileback to summary
public boolean generateRollbackStatementsVolatile(Database database)

Returns true if this change reads data from the database or other sources that would change during the course of an update in the generateRollbackStatements(Database) method. If true, this change cannot be used in an updateSql-style commands because Liquibase cannot know the SqlStatement objects until all changeSets prior have been actually executed.

generateStatementsback to summary
public SqlStatement[] generateStatements(Database database)

Generates the SqlStatement objects required to run the change for the given database.

NOTE: This method may be called multiple times throughout the changelog execution process and may be called in documentation generation and other integration points as well.

If this method reads from the current database state or uses any other logic that will be affected by whether previous changeSets have ran or not, you must return true from generateStatementsVolatile.
generateStatementsVolatileback to summary
public boolean generateStatementsVolatile(Database database)

Returns true if this change reads data from the database or other sources that would change during the course of an update in the generateStatements(Database) method. If true, this change cannot be used in an updateSql-style commands because Liquibase cannot know the SqlStatement objects until all changeSets prior have been actually executed.

getAffectedDatabaseObjectsback to summary
public Set<DatabaseObject> getAffectedDatabaseObjects(Database database)

Returns example DatabaseObject instances describing the objects affected by this change. This method is not called during the normal execution of a changelog, but can be used as metadata for documentation or other integrations.

getChangeSetback to summary
public ChangeSet getChangeSet()

Returns the changeSet this Change is part of. Will return null if this instance was not constructed as part of a changelog file.

getConfirmationMessageback to summary
public String getConfirmationMessage()

Confirmation message to be displayed after the change is executed. Should include relevant configuration settings to make it as helpful as possible. This method may be called outside the changelog execution process, such as in documentation generation.

getDescriptionback to summary
public String getDescription()

Short, scannable description for the DATABASECHANGELOG.DESCRIPTION column

modifyback to summary
public void modify(ChangeVisitor changeVisitor) throws ParsedNodeException
Exceptions
ParsedNodeException:
if there is an error processing ChangeVisitor
setChangeSetback to summary
public void setChangeSet(ChangeSet changeSet)

Sets the changeSet this Change is a part of. Called automatically by Liquibase during the changelog parsing process.

setResourceAccessorback to summary
public void setResourceAccessor(ResourceAccessor resourceAccessor)

Deprecated

this is now set via Scope

Sets the ResourceAccessor that should be used for any file and/or resource loading needed by this Change. Called automatically by Liquibase during the changelog parsing process.

supportsback to summary
public boolean supports(Database database)

Return true if this Change object supports the passed database. Used by the ChangeLog parsing process.

supportsRollbackback to summary
public boolean supportsRollback(Database database)

Returns true if this can change be rolled back for the given database.

validateback to summary
public ValidationErrors validate(Database database)

Generate errors based on the configured Change instance. If there are any validation errors, changelog processing will normally not occur. Can return null or empty ValidationErrors object when there are no errors.

warnback to summary
public Warnings warn(Database database)

Generates warnings based on the configured Change instance. Warnings do not stop changelog execution, but are passed along to the end user for reference. Can return null or an empty Warnings object when there are no warnings.