Class Liquibase
- All Implemented Interfaces:
AutoCloseable
As of Liquibase 4.* some of the built-in command line, Ant, Maven, tests and other ways of running Liquibase are wrappers around methods in this class, but this may change in future releases as we continue to refactor the codebase and move to CommandScope instances.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionLiquibase
(String changeLogFile, ResourceAccessor resourceAccessor, Database database) Creates a Liquibase instance.Liquibase
(String changeLogFile, ResourceAccessor resourceAccessor, DatabaseConnection conn) Creates a Liquibase instance for a given DatabaseConnection.Liquibase
(DatabaseChangeLog changeLog, ResourceAccessor resourceAccessor, Database database) -
Method Summary
Modifier and TypeMethodDescriptionfinal CheckSum
calculateCheckSum
(String changeSetIdentifier) Calculate the checksum for a given identifiercalculateCheckSum
(String changeSetPath, String changeSetId, String changeSetAuthor) Calculate the checksum for a given changeset specified by path, changeset id and authorvoid
changeLogSync
(String contexts) void
changeLogSync
(String contexts, Writer output) void
changeLogSync
(String tag, String contexts) void
changeLogSync
(String tag, String contexts, Writer output) void
changeLogSync
(String tag, Contexts contexts, LabelExpression labelExpression) Synchronizes the changelog with the database up to a specified tag.void
changeLogSync
(String tag, Contexts contexts, LabelExpression labelExpression, Writer output) void
changeLogSync
(Contexts contexts) Deprecated.use version with LabelExpressionvoid
changeLogSync
(Contexts contexts, LabelExpression labelExpression) void
changeLogSync
(Contexts contexts, LabelExpression labelExpression, Writer output) void
checkLiquibaseTables
(boolean updateExistingNullChecksums, DatabaseChangeLog databaseChangeLog, Contexts contexts, LabelExpression labelExpression) void
Sets checksums to null, so they will be repopulated next runvoid
close()
diff
(Database referenceDatabase, Database targetDatabase, CompareControl compareControl) final void
dropAll()
Drops all database objects in the default schema.final void
Drops all database objects in the default schema.final void
dropAll
(Boolean dropDbclhistory, CatalogAndSchema... schemas) Drops all database objects in the passed schema(s).final void
dropAll
(CatalogAndSchema... schemas) Drops all database objects in the passed schema(s).void
void
futureRollbackSQL
(Writer output) void
futureRollbackSQL
(Integer count, String contexts, Writer output) void
futureRollbackSQL
(Integer count, String contexts, Writer output, boolean checkLiquibaseTables) protected void
futureRollbackSQL
(Integer count, String tag, Contexts contexts, LabelExpression labelExpression, Writer output) protected void
futureRollbackSQL
(Integer count, String tag, Contexts contexts, LabelExpression labelExpression, Writer output, boolean checkLiquibaseTables) void
futureRollbackSQL
(Integer count, Contexts contexts, LabelExpression labelExpression, Writer output) void
futureRollbackSQL
(Integer count, Contexts contexts, LabelExpression labelExpression, Writer output, boolean checkLiquibaseTables) void
futureRollbackSQL
(String contexts, Writer output) void
futureRollbackSQL
(String contexts, Writer output, boolean checkLiquibaseTables) void
futureRollbackSQL
(String tag, Contexts contexts, LabelExpression labelExpression, Writer output) void
futureRollbackSQL
(Contexts contexts, LabelExpression labelExpression, Writer output) final void
generateChangeLog
(CatalogAndSchema catalogAndSchema, DiffToChangeLog changeLogWriter, PrintStream outputStream, Class<? extends DatabaseObject>... snapshotTypes) final void
generateChangeLog
(CatalogAndSchema catalogAndSchema, DiffToChangeLog changeLogWriter, PrintStream outputStream, ChangeLogSerializer changeLogSerializer, Class<? extends DatabaseObject>... snapshotTypes) void
generateDocumentation
(String outputDirectory) void
generateDocumentation
(String outputDirectory, String contexts) void
generateDocumentation
(String outputDirectory, String contexts, CatalogAndSchema... schemaList) void
generateDocumentation
(String outputDirectory, Contexts contexts, LabelExpression labelExpression, CatalogAndSchema... schemaList) getChangeSetStatuses
(Contexts contexts) Deprecated.use version with LabelExpressiongetChangeSetStatuses
(Contexts contexts, LabelExpression labelExpression) getChangeSetStatuses
(Contexts contexts, LabelExpression labelExpression, boolean checkLiquibaseTables) Returns the ChangeSetStatuses of all changesets in the change log file and history in the order they would be ran.getLog()
Return the log used by this Liquibase instance.protected ChangeLogIterator
getStandardChangelogIterator
(Contexts contexts, LabelExpression labelExpression, DatabaseChangeLog changeLog) Return a ChangeLogIterator constructed with standard filters for processing the specified changelog.boolean
Returns true if it is "save" to migrate the database.protected boolean
isUpToDateFastCheck
(Contexts contexts, LabelExpression labelExpression) Deprecated.this method has been moved toFastCheckService
, use that one instead.Display change log lock information.listUnexpectedChangeSets
(String contexts) listUnexpectedChangeSets
(Contexts contexts, LabelExpression labelExpression) listUnrunChangeSets
(Contexts contexts) Deprecated.use version with LabelExpressionlistUnrunChangeSets
(Contexts contexts, LabelExpression labels) listUnrunChangeSets
(Contexts contexts, LabelExpression labels, boolean checkLiquibaseTables) void
markNextChangeSetRan
(String contexts) void
markNextChangeSetRan
(String contexts, Writer output) void
markNextChangeSetRan
(Contexts contexts, LabelExpression labelExpression) void
markNextChangeSetRan
(Contexts contexts, LabelExpression labelExpression, Writer output) void
outputHeader
(String message) Deprecated.use {@link LoggingExecutorTextUtil#outputHeader(String, Database, String))}void
reportLocks
(PrintStream out) void
reportStatus
(boolean verbose, String contexts, Writer out) void
reportStatus
(boolean verbose, Contexts contexts, Writer out) void
reportStatus
(boolean verbose, Contexts contexts, LabelExpression labels, Writer out) void
reportUnexpectedChangeSets
(boolean verbose, String contexts, Writer out) void
reportUnexpectedChangeSets
(boolean verbose, Contexts contexts, LabelExpression labelExpression, Writer out) protected void
void
void
void
void
void
void
rollback
(int changesToRollback, String rollbackScript, Contexts contexts, LabelExpression labelExpression) Rolls back a specified number of changesets.void
rollback
(int changesToRollback, String rollbackScript, Contexts contexts, LabelExpression labelExpression, Writer output) void
void
rollback
(int changesToRollback, Contexts contexts, LabelExpression labelExpression) void
rollback
(int changesToRollback, Contexts contexts, LabelExpression labelExpression, Writer output) void
void
void
void
void
void
void
rollback
(String tagToRollBackTo, String rollbackScript, Contexts contexts, LabelExpression labelExpression) Rolls back the database to a specific tag, using either a generated or user-defined rollback script.void
rollback
(String tagToRollBackTo, String rollbackScript, Contexts contexts, LabelExpression labelExpression, Writer output) void
void
void
rollback
(String tagToRollBackTo, Contexts contexts, LabelExpression labelExpression) void
rollback
(String tagToRollBackTo, Contexts contexts, LabelExpression labelExpression, Writer output) void
void
void
void
void
rollback
(Date dateToRollBackTo, String rollbackScript, Contexts contexts, LabelExpression labelExpression) Rolls back all changesets that were applied after the specified date.void
rollback
(Date dateToRollBackTo, String rollbackScript, Contexts contexts, LabelExpression labelExpression, Writer output) void
rollback
(Date dateToRollBackTo, Contexts contexts, LabelExpression labelExpression) void
rollback
(Date dateToRollBackTo, Contexts contexts, LabelExpression labelExpression, Writer output) void
setChangeLogParameter
(String key, Object value) void
'Tags' the database for future rollbackboolean
Verifies if a given tag exist in the databasevoid
update()
Convenience method forupdate(Contexts)
that runs in "no context mode".void
void
void
update
(int changesToApply, Contexts contexts, LabelExpression labelExpression) Updates the database schema with the specified number of changesets, within the given contexts and matching the given label expression.void
update
(int changesToApply, Contexts contexts, LabelExpression labelExpression, Writer output) void
Convenience method forupdate(Contexts)
that constructs the Context object from the passed string.void
void
void
void
void
void
update
(String tag, Contexts contexts, LabelExpression labelExpression) Updates the database to a specified tag.void
update
(String tag, Contexts contexts, LabelExpression labelExpression, Writer output) void
Executes Liquibase "update" logic which ensures that the configuredDatabase
is up to date according to the configured changelog file.void
void
update
(Contexts contexts, LabelExpression labelExpression) Executes Liquibase update with given contexts and label expression.void
update
(Contexts contexts, LabelExpression labelExpression, boolean checkLiquibaseTables) Updates the database schema to the latest version.void
update
(Contexts contexts, LabelExpression labelExpression, Writer output) void
update
(Contexts contexts, LabelExpression labelExpression, Writer output, boolean checkLiquibaseTables) void
updateCountSql
(int count, Contexts contexts, LabelExpression labelExpression, Writer output) void
updateTestingRollback
(String contexts) void
updateTestingRollback
(String tag, Contexts contexts, LabelExpression labelExpression) void
updateTestingRollback
(Contexts contexts, LabelExpression labelExpression) void
updateToTagSql
(String tag, Contexts contexts, LabelExpression labelExpression, Writer writer) void
validate()
Checks changelogs for bad MD5Sums and preconditions before attempting a migration
-
Field Details
-
MSG_COULD_NOT_RELEASE_LOCK
-
database
Returns the Database used by this Liquibase instance.
-
-
Constructor Details
-
Liquibase
public Liquibase(String changeLogFile, ResourceAccessor resourceAccessor, DatabaseConnection conn) throws LiquibaseException Creates a Liquibase instance for a given DatabaseConnection. The Database instance used will be found withDatabaseFactory.findCorrectDatabaseImplementation(liquibase.database.DatabaseConnection)
-
Liquibase
Creates a Liquibase instance. The changeLogFile parameter must be a path that can be resolved by the passed ResourceAccessor. If windows style path separators are used for the changeLogFile, they will be standardized to unix style for better cross-system compatibility.- See Also:
-
Liquibase
-
-
Method Details
-
getLog
Return the log used by this Liquibase instance. -
update
Convenience method forupdate(Contexts)
that runs in "no context mode".- Throws:
LiquibaseException
- See Also:
-
- contexts in documentation
-
update
Convenience method forupdate(Contexts)
that constructs the Context object from the passed string. To run in "no context mode", pass a null or empty "".- Throws:
LiquibaseException
- See Also:
-
- contexts in documentation
-
update
Executes Liquibase "update" logic which ensures that the configuredDatabase
is up to date according to the configured changelog file. To run in "no context mode", pass a null or empty context object.- Throws:
LiquibaseException
- See Also:
-
- contexts in documentation
-
update
Executes Liquibase update with given contexts and label expression.- Parameters:
contexts
- the set of contexts to execute the update against. If empty ornull
, all contexts are used.labelExpression
- the label expression to use during the update. If empty ornull
, no labels are used.- Throws:
LiquibaseException
- If an error occurs while executing the update.- See Also:
-
- Liquibase Contexts in the Liquibase documentation
- Liquibase Labels in the Liquibase documentation
-
update
public void update(Contexts contexts, LabelExpression labelExpression, boolean checkLiquibaseTables) throws LiquibaseException Updates the database schema to the latest version. This method performs a Liquibase update operation, which can include applying changesets that modify the database schema.- Parameters:
contexts
- the set of contexts to execute the update against. If empty or null, all contexts are used.labelExpression
- the label expression to use during the update. If empty or null, no labels are used.checkLiquibaseTables
- whether to check for Liquibase metadata tables before updating. If false, Liquibase will assume that the metadata tables already exist and will not attempt to create them.- Throws:
LiquibaseException
- if an error occurs while updating the database schema.- See Also:
-
isUpToDateFastCheck
@Deprecated protected boolean isUpToDateFastCheck(Contexts contexts, LabelExpression labelExpression) throws LiquibaseException Deprecated.this method has been moved toFastCheckService
, use that one instead.Performs check of the historyService to determine if there is no unrun changesets without obtaining an exclusive write lock. This allows multiple peer services to boot in parallel in the common case where there are no changelogs to run.If we see that there is nothing in the changelog to run and this returns true, then regardless of the lock status we already know we are "done" and can finish up without waiting for the lock.
But, if there are changelogs that might have to be ran and this returns false, you MUST get a lock and do a real check to know what changesets actually need to run.
NOTE: to reduce the number of queries to the databasehistory table, this method will cache the "fast check" results within this instance under the assumption that the total changesets will not change within this instance.
- Throws:
LiquibaseException
-
getDatabaseChangeLog
- Throws:
LiquibaseException
-
getStandardChangelogIterator
protected ChangeLogIterator getStandardChangelogIterator(Contexts contexts, LabelExpression labelExpression, DatabaseChangeLog changeLog) throws DatabaseException Return a ChangeLogIterator constructed with standard filters for processing the specified changelog.- Parameters:
contexts
- The contexts to filter for.labelExpression
- The labels to filter for.changeLog
- The changelog to process.- Returns:
- a ChangeLogIterator instance.
- Throws:
DatabaseException
- if there is an error with the database.
-
update
- Throws:
LiquibaseException
-
update
- Throws:
LiquibaseException
-
update
public void update(Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
update
public void update(Contexts contexts, LabelExpression labelExpression, Writer output, boolean checkLiquibaseTables) throws LiquibaseException - Throws:
LiquibaseException
-
updateCountSql
public void updateCountSql(int count, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
update
- Throws:
LiquibaseException
-
update
public void update(int changesToApply, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException Updates the database schema with the specified number of changesets, within the given contexts and matching the given label expression.- Parameters:
changesToApply
- the number of changesets to apply.contexts
- the contexts in which the changesets should be applied.labelExpression
- the label expression used to filter the changesets.- Throws:
LiquibaseException
- if there is an error while updating the schema.
-
update
- Throws:
LiquibaseException
-
update
- Throws:
LiquibaseException
-
update
public void update(String tag, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException Updates the database to a specified tag.- Parameters:
tag
- The tag to update the database to.contexts
- The contexts to execute in.labelExpression
- The label expression to execute with.- Throws:
LiquibaseException
- if there is an error updating the database.
-
updateToTagSql
public void updateToTagSql(String tag, Contexts contexts, LabelExpression labelExpression, Writer writer) throws LiquibaseException - Throws:
LiquibaseException
-
update
- Throws:
LiquibaseException
-
update
public void update(int changesToApply, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
update
- Throws:
LiquibaseException
-
update
- Throws:
LiquibaseException
-
update
public void update(String tag, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
outputHeader
Deprecated.use {@link LoggingExecutorTextUtil#outputHeader(String, Database, String))}- Throws:
DatabaseException
-
rollback
public void rollback(int changesToRollback, String contexts, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(int changesToRollback, Contexts contexts, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(int changesToRollback, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(int changesToRollback, String rollbackScript, String contexts, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(int changesToRollback, String rollbackScript, Contexts contexts, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(int changesToRollback, String rollbackScript, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
- Throws:
LiquibaseException
-
rollback
public void rollback(int changesToRollback, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(int changesToRollback, String rollbackScript, String contexts) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(int changesToRollback, String rollbackScript, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException Rolls back a specified number of changesets. The `changesToRollback` parameter specifies how many changesets to roll back, and the `rollbackScript` parameter specifies the path to a custom SQL script to use for the rollback. The `contexts` parameter specifies which contexts to include in the rollback, and the `labelExpression` parameter specifies which labels to include in the rollback.- Parameters:
changesToRollback
- the number of changesets to roll backrollbackScript
- the path to a custom SQL script to use for the rollback, or `null` to use Liquibase's built-in rollback functionalitycontexts
- the contexts to include in the rollback, or `null` to include all contextslabelExpression
- the labels to include in the rollback, or `null` to include all labels- Throws:
LiquibaseException
- if an error occurs while rolling back the changesets
-
rollback
public void rollback(String tagToRollBackTo, String contexts, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(String tagToRollBackTo, Contexts contexts, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(String tagToRollBackTo, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(String tagToRollBackTo, String rollbackScript, String contexts, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(String tagToRollBackTo, String rollbackScript, Contexts contexts, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(String tagToRollBackTo, String rollbackScript, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
- Throws:
LiquibaseException
-
rollback
- Throws:
LiquibaseException
-
rollback
public void rollback(String tagToRollBackTo, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(String tagToRollBackTo, String rollbackScript, String contexts) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(String tagToRollBackTo, String rollbackScript, Contexts contexts) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(String tagToRollBackTo, String rollbackScript, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException Rolls back the database to a specific tag, using either a generated or user-defined rollback script.- Parameters:
tagToRollBackTo
- the tag to which the database should be rolled back.rollbackScript
- an optional path to a user-defined rollback script. If null, Liquibase will generate the rollback SQL automatically.contexts
- a list of contexts to include when rolling back the database. May be null.labelExpression
- a label expression to filter the change sets to rollback. May be null.- Throws:
LiquibaseException
- if there is a problem rolling back the database.
-
rollback
public void rollback(Date dateToRollBackTo, String contexts, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(Date dateToRollBackTo, String rollbackScript, String contexts, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(Date dateToRollBackTo, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(Date dateToRollBackTo, String rollbackScript, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
- Throws:
LiquibaseException
-
rollback
public void rollback(Date dateToRollBackTo, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(Date dateToRollBackTo, String rollbackScript, String contexts) throws LiquibaseException - Throws:
LiquibaseException
-
rollback
public void rollback(Date dateToRollBackTo, String rollbackScript, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException Rolls back all changesets that were applied after the specified date. If a rollback script is provided, the changesets are rolled back in reverse order until the script is reached. Otherwise, the changesets are rolled back in reverse order until the rollback point is reached.- Parameters:
dateToRollBackTo
- the date to roll back torollbackScript
- the path to a SQL script to execute for the rollback (optional)contexts
- the contexts to execute the rollback in (optional)labelExpression
- the label expression to use for filtering change sets (optional)- Throws:
LiquibaseException
- if there was an error rolling back the changes
-
changeLogSync
- Throws:
LiquibaseException
-
changeLogSync
public void changeLogSync(Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
changeLogSync
- Throws:
LiquibaseException
-
changeLogSync
Deprecated.use version with LabelExpression- Throws:
LiquibaseException
-
changeLogSync
public void changeLogSync(Contexts contexts, LabelExpression labelExpression) throws LiquibaseException - Throws:
LiquibaseException
-
changeLogSync
- Throws:
LiquibaseException
-
changeLogSync
public void changeLogSync(String tag, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException Synchronizes the changelog with the database up to a specified tag.- Parameters:
tag
- the tag up to which the changelog should be synchronizedcontexts
- the contexts to use for the synchronizationlabelExpression
- the label expression to use for the synchronization- Throws:
LiquibaseException
- if an error occurs during the synchronization
-
changeLogSync
- Throws:
LiquibaseException
-
changeLogSync
public void changeLogSync(String tag, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
markNextChangeSetRan
- Throws:
LiquibaseException
-
markNextChangeSetRan
public void markNextChangeSetRan(Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
markNextChangeSetRan
- Throws:
LiquibaseException
-
markNextChangeSetRan
public void markNextChangeSetRan(Contexts contexts, LabelExpression labelExpression) throws LiquibaseException - Throws:
LiquibaseException
-
futureRollbackSQL
- Throws:
LiquibaseException
-
futureRollbackSQL
- Throws:
LiquibaseException
-
futureRollbackSQL
public void futureRollbackSQL(String contexts, Writer output, boolean checkLiquibaseTables) throws LiquibaseException - Throws:
LiquibaseException
-
futureRollbackSQL
public void futureRollbackSQL(Integer count, String contexts, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
futureRollbackSQL
public void futureRollbackSQL(Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
futureRollbackSQL
public void futureRollbackSQL(Integer count, String contexts, Writer output, boolean checkLiquibaseTables) throws LiquibaseException - Throws:
LiquibaseException
-
futureRollbackSQL
public void futureRollbackSQL(Integer count, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
futureRollbackSQL
public void futureRollbackSQL(Integer count, Contexts contexts, LabelExpression labelExpression, Writer output, boolean checkLiquibaseTables) throws LiquibaseException - Throws:
LiquibaseException
-
futureRollbackSQL
public void futureRollbackSQL(String tag, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
futureRollbackSQL
protected void futureRollbackSQL(Integer count, String tag, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException - Throws:
LiquibaseException
-
futureRollbackSQL
protected void futureRollbackSQL(Integer count, String tag, Contexts contexts, LabelExpression labelExpression, Writer output, boolean checkLiquibaseTables) throws LiquibaseException - Throws:
LiquibaseException
-
resetServices
protected void resetServices() -
dropAll
Drops all database objects in the default schema.- Throws:
DatabaseException
-
dropAll
Drops all database objects in the default schema.- Parameters:
dropDbclhistory
- If true, the database changelog history table will be dropped. Requires pro license.- Throws:
DatabaseException
-
dropAll
Drops all database objects in the passed schema(s).- Throws:
DatabaseException
-
dropAll
public final void dropAll(Boolean dropDbclhistory, CatalogAndSchema... schemas) throws DatabaseException Drops all database objects in the passed schema(s).- Parameters:
dropDbclhistory
- If true, the database changelog history table will be dropped. Requires pro license.- Throws:
DatabaseException
-
tag
'Tags' the database for future rollback- Throws:
LiquibaseException
-
tagExists
Verifies if a given tag exist in the database- Throws:
LiquibaseException
-
updateTestingRollback
- Throws:
LiquibaseException
-
updateTestingRollback
public void updateTestingRollback(Contexts contexts, LabelExpression labelExpression) throws LiquibaseException - Throws:
LiquibaseException
-
updateTestingRollback
public void updateTestingRollback(String tag, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException - Throws:
LiquibaseException
-
checkLiquibaseTables
public void checkLiquibaseTables(boolean updateExistingNullChecksums, DatabaseChangeLog databaseChangeLog, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException - Throws:
LiquibaseException
-
isSafeToRunUpdate
Returns true if it is "save" to migrate the database. Currently, "safe" is defined as running in an output-sql mode or against a database on localhost. It is fine to run Liquibase against a "non-safe" database, the method is mainly used to determine if the user should be prompted before continuing.- Throws:
DatabaseException
-
listLocks
Display change log lock information.- Throws:
LiquibaseException
-
reportLocks
- Throws:
LiquibaseException
-
forceReleaseLocks
- Throws:
LiquibaseException
-
listUnrunChangeSets
Deprecated.use version with LabelExpression- Throws:
LiquibaseException
-
listUnrunChangeSets
public List<ChangeSet> listUnrunChangeSets(Contexts contexts, LabelExpression labels) throws LiquibaseException - Throws:
LiquibaseException
-
listUnrunChangeSets
public List<ChangeSet> listUnrunChangeSets(Contexts contexts, LabelExpression labels, boolean checkLiquibaseTables) throws LiquibaseException - Throws:
LiquibaseException
-
getChangeSetStatuses
@Deprecated public List<ChangeSetStatus> getChangeSetStatuses(Contexts contexts) throws LiquibaseException Deprecated.use version with LabelExpression- Throws:
LiquibaseException
-
getChangeSetStatuses
public List<ChangeSetStatus> getChangeSetStatuses(Contexts contexts, LabelExpression labelExpression) throws LiquibaseException - Throws:
LiquibaseException
-
getChangeSetStatuses
public List<ChangeSetStatus> getChangeSetStatuses(Contexts contexts, LabelExpression labelExpression, boolean checkLiquibaseTables) throws LiquibaseException Returns the ChangeSetStatuses of all changesets in the change log file and history in the order they would be ran.- Throws:
LiquibaseException
-
reportStatus
- Throws:
LiquibaseException
-
reportStatus
- Throws:
LiquibaseException
-
reportStatus
public void reportStatus(boolean verbose, Contexts contexts, LabelExpression labels, Writer out) throws LiquibaseException - Throws:
LiquibaseException
-
listUnexpectedChangeSets
- Throws:
LiquibaseException
-
listUnexpectedChangeSets
public Collection<RanChangeSet> listUnexpectedChangeSets(Contexts contexts, LabelExpression labelExpression) throws LiquibaseException - Throws:
LiquibaseException
-
reportUnexpectedChangeSets
public void reportUnexpectedChangeSets(boolean verbose, String contexts, Writer out) throws LiquibaseException - Throws:
LiquibaseException
-
reportUnexpectedChangeSets
public void reportUnexpectedChangeSets(boolean verbose, Contexts contexts, LabelExpression labelExpression, Writer out) throws LiquibaseException - Throws:
LiquibaseException
-
clearCheckSums
Sets checksums to null, so they will be repopulated next run- Throws:
LiquibaseException
-
calculateCheckSum
Calculate the checksum for a given identifier- Throws:
LiquibaseException
-
calculateCheckSum
public CheckSum calculateCheckSum(String changeSetPath, String changeSetId, String changeSetAuthor) throws LiquibaseException Calculate the checksum for a given changeset specified by path, changeset id and author- Throws:
LiquibaseException
-
generateDocumentation
- Throws:
LiquibaseException
-
generateDocumentation
public void generateDocumentation(String outputDirectory, String contexts) throws LiquibaseException - Throws:
LiquibaseException
-
generateDocumentation
public void generateDocumentation(String outputDirectory, String contexts, CatalogAndSchema... schemaList) throws LiquibaseException - Throws:
LiquibaseException
-
generateDocumentation
public void generateDocumentation(String outputDirectory, Contexts contexts, LabelExpression labelExpression, CatalogAndSchema... schemaList) throws LiquibaseException - Throws:
LiquibaseException
-
diff
public DiffResult diff(Database referenceDatabase, Database targetDatabase, CompareControl compareControl) throws LiquibaseException - Throws:
LiquibaseException
-
validate
Checks changelogs for bad MD5Sums and preconditions before attempting a migration- Throws:
LiquibaseException
-
setChangeLogParameter
-
generateChangeLog
@SafeVarargs public final void generateChangeLog(CatalogAndSchema catalogAndSchema, DiffToChangeLog changeLogWriter, PrintStream outputStream, Class<? extends DatabaseObject>... snapshotTypes) throws DatabaseException, CommandExecutionException -
generateChangeLog
@SafeVarargs public final void generateChangeLog(CatalogAndSchema catalogAndSchema, DiffToChangeLog changeLogWriter, PrintStream outputStream, ChangeLogSerializer changeLogSerializer, Class<? extends DatabaseObject>... snapshotTypes) throws DatabaseException, CommandExecutionException -
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
LiquibaseException
-