Package liquibase
Class Liquibase
- java.lang.Object
-
- liquibase.Liquibase
-
- All Implemented Interfaces:
AutoCloseable
public class Liquibase extends Object implements AutoCloseable
Primary facade class for interacting with Liquibase. The built in command line, Ant, Maven and other ways of running Liquibase are wrappers around methods in this class.
-
-
Field Summary
Fields Modifier and Type Field Description protected Database
database
static String
MSG_COULD_NOT_RELEASE_LOCK
-
Constructor Summary
Constructors Constructor Description Liquibase(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
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CheckSum
calculateCheckSum(String changeSetIdentifier)
Deprecated.Use {linkCommandScope(String)
.CheckSum
calculateCheckSum(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
clearCheckSums()
Deprecated.UseCommandScope(String)
void
close()
DiffResult
diff(Database referenceDatabase, Database targetDatabase, CompareControl compareControl)
Deprecated.Use {linkCommandScope(String)
to generate diff instead of this method.void
dropAll()
Drops all database objects in the default schema.void
dropAll(Boolean dropDbclhistory)
Drops all database objects in the default schema.void
dropAll(Boolean dropDbclhistory, CatalogAndSchema... schemas)
Drops all database objects in the passed schema(s).void
dropAll(CatalogAndSchema... schemas)
Drops all database objects in the passed schema(s).void
forceReleaseLocks()
void
futureRollbackSQL(Writer output)
Deprecated.void
futureRollbackSQL(Integer count, String contexts, Writer output)
Deprecated.void
futureRollbackSQL(Integer count, String contexts, Writer output, boolean checkLiquibaseTables)
Deprecated.protected void
futureRollbackSQL(Integer count, String tag, Contexts contexts, LabelExpression labelExpression, Writer output)
Deprecated.protected void
futureRollbackSQL(Integer count, String tag, Contexts contexts, LabelExpression labelExpression, Writer output, boolean checkLiquibaseTables)
Deprecated.void
futureRollbackSQL(Integer count, Contexts contexts, LabelExpression labelExpression, Writer output)
Deprecated.void
futureRollbackSQL(Integer count, Contexts contexts, LabelExpression labelExpression, Writer output, boolean checkLiquibaseTables)
Deprecated.void
futureRollbackSQL(String contexts, Writer output)
Deprecated.void
futureRollbackSQL(String contexts, Writer output, boolean checkLiquibaseTables)
Deprecated.void
futureRollbackSQL(String tag, Contexts contexts, LabelExpression labelExpression, Writer output)
Deprecated.void
futureRollbackSQL(Contexts contexts, LabelExpression labelExpression, Writer output)
Deprecated.void
generateChangeLog(CatalogAndSchema catalogAndSchema, DiffToChangeLog changeLogWriter, PrintStream outputStream, Class<? extends DatabaseObject>... snapshotTypes)
Deprecated.Use {linkCommandScope(String)
to generateChangelog instead of this method.void
generateChangeLog(CatalogAndSchema catalogAndSchema, DiffToChangeLog changeLogWriter, PrintStream outputStream, ChangeLogSerializer changeLogSerializer, Class<? extends DatabaseObject>... snapshotTypes)
Deprecated.Use {linkCommandScope(String)
to generateChangelog instead of this method.void
generateDocumentation(String outputDirectory)
Deprecated.void
generateDocumentation(String outputDirectory, String contexts)
Deprecated.void
generateDocumentation(String outputDirectory, String contexts, CatalogAndSchema... schemaList)
Deprecated.void
generateDocumentation(String outputDirectory, Contexts contexts, LabelExpression labelExpression, CatalogAndSchema... schemaList)
Deprecated.UseCommandScope
to generate dbDoc instead of this method.String
getChangeLogFile()
Return the change log file used by this Liquibase instance.ChangeLogParameters
getChangeLogParameters()
Returns the ChangeLogParameters container used by this Liquibase instance.List<ChangeSetStatus>
getChangeSetStatuses(Contexts contexts)
Deprecated.use version with LabelExpressionList<ChangeSetStatus>
getChangeSetStatuses(Contexts contexts, LabelExpression labelExpression)
List<ChangeSetStatus>
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.Database
getDatabase()
Returns the Database used by this Liquibase instance.DatabaseChangeLog
getDatabaseChangeLog()
DefaultChangeExecListener
getDefaultChangeExecListener()
Logger
getLog()
Return the log used by this Liquibase instance.ResourceAccessor
getResourceAccessor()
Return ResourceAccessor 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
isSafeToRunUpdate()
Returns true if it is "save" to migrate the database.protected boolean
isUpToDateFastCheck(Contexts contexts, LabelExpression labelExpression)
Deprecated.this method has been moved toAbstractUpdateCommandStep
, use that one instead.DatabaseChangeLogLock[]
listLocks()
Deprecated.Collection<RanChangeSet>
listUnexpectedChangeSets(String contexts)
Deprecated.Collection<RanChangeSet>
listUnexpectedChangeSets(Contexts contexts, LabelExpression labelExpression)
Deprecated.List<ChangeSet>
listUnrunChangeSets(Contexts contexts)
Deprecated.use version with LabelExpressionList<ChangeSet>
listUnrunChangeSets(Contexts contexts, LabelExpression labels)
Deprecated.List<ChangeSet>
listUnrunChangeSets(Contexts contexts, LabelExpression labels, boolean checkLiquibaseTables)
Deprecated.void
markNextChangeSetRan(String contexts)
Deprecated.void
markNextChangeSetRan(String contexts, Writer output)
Deprecated.void
markNextChangeSetRan(Contexts contexts, LabelExpression labelExpression)
Deprecated.void
markNextChangeSetRan(Contexts contexts, LabelExpression labelExpression, Writer output)
Deprecated.void
outputHeader(String message)
Deprecated.use {@link LoggingExecutorTextUtil#outputHeader(String, Database, String))}void
reportLocks(PrintStream out)
Deprecated.void
reportStatus(boolean verbose, String contexts, Writer out)
Deprecated.void
reportStatus(boolean verbose, Contexts contexts, Writer out)
Deprecated.void
reportStatus(boolean verbose, Contexts contexts, LabelExpression labels, Writer out)
Deprecated.void
reportUnexpectedChangeSets(boolean verbose, String contexts, Writer out)
Deprecated.void
reportUnexpectedChangeSets(boolean verbose, Contexts contexts, LabelExpression labelExpression, Writer out)
Deprecated.protected void
resetServices()
void
rollback(int changesToRollback, String contexts)
void
rollback(int changesToRollback, String contexts, Writer output)
void
rollback(int changesToRollback, String rollbackScript, String contexts)
void
rollback(int changesToRollback, String rollbackScript, String contexts, Writer output)
void
rollback(int changesToRollback, String rollbackScript, Contexts contexts, Writer output)
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
rollback(int changesToRollback, Contexts contexts, Writer output)
void
rollback(int changesToRollback, Contexts contexts, LabelExpression labelExpression)
void
rollback(int changesToRollback, Contexts contexts, LabelExpression labelExpression, Writer output)
void
rollback(String tagToRollBackTo, String contexts)
Deprecated.void
rollback(String tagToRollBackTo, String contexts, Writer output)
Deprecated.void
rollback(String tagToRollBackTo, String rollbackScript, String contexts)
Deprecated.void
rollback(String tagToRollBackTo, String rollbackScript, String contexts, Writer output)
Deprecated.void
rollback(String tagToRollBackTo, String rollbackScript, Contexts contexts)
Deprecated.void
rollback(String tagToRollBackTo, String rollbackScript, Contexts contexts, Writer output)
Deprecated.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)
Deprecated.void
rollback(String tagToRollBackTo, Contexts contexts)
Deprecated.void
rollback(String tagToRollBackTo, Contexts contexts, Writer output)
Deprecated.void
rollback(String tagToRollBackTo, Contexts contexts, LabelExpression labelExpression)
Deprecated.void
rollback(String tagToRollBackTo, Contexts contexts, LabelExpression labelExpression, Writer output)
Deprecated.void
rollback(Date dateToRollBackTo, String contexts)
void
rollback(Date dateToRollBackTo, String contexts, Writer output)
void
rollback(Date dateToRollBackTo, String rollbackScript, String contexts)
void
rollback(Date dateToRollBackTo, String rollbackScript, String contexts, Writer output)
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
setChangeExecListener(ChangeExecListener listener)
void
setChangeLogParameter(String key, Object value)
void
setShowSummary(UpdateSummaryEnum showSummary)
void
setShowSummaryOutput(UpdateSummaryOutputEnum showSummaryOutput)
void
tag(String tagString)
Deprecated.UseCommandScope(String)
to tag instead of this method.boolean
tagExists(String tagString)
Deprecated.Use {linkCommandScope(String)
to verify tag exist instead of this method.void
update()
Deprecated.useCommandScope
void
update(int changesToApply, String contexts)
Deprecated.void
update(int changesToApply, String contexts, Writer output)
Deprecated.void
update(int changesToApply, Contexts contexts, LabelExpression labelExpression)
Deprecated.void
update(int changesToApply, Contexts contexts, LabelExpression labelExpression, Writer output)
Deprecated.void
update(String contexts)
Deprecated.useCommandScope
void
update(String contexts, Writer output)
Deprecated.void
update(String tag, String contexts)
Deprecated.void
update(String tag, String contexts, Writer output)
Deprecated.void
update(String tag, Contexts contexts)
Deprecated.void
update(String tag, Contexts contexts, Writer output)
Deprecated.void
update(String tag, Contexts contexts, LabelExpression labelExpression)
Deprecated.void
update(String tag, Contexts contexts, LabelExpression labelExpression, Writer output)
Deprecated.void
update(Contexts contexts)
Deprecated.useCommandScope
void
update(Contexts contexts, Writer output)
Deprecated.void
update(Contexts contexts, LabelExpression labelExpression)
Deprecated.useCommandScope
void
update(Contexts contexts, LabelExpression labelExpression, boolean checkLiquibaseTables)
Deprecated.useCommandScope
void
update(Contexts contexts, LabelExpression labelExpression, Writer output)
Deprecated.void
update(Contexts contexts, LabelExpression labelExpression, Writer output, boolean checkLiquibaseTables)
Deprecated.void
updateTestingRollback(String contexts)
Deprecated.void
updateTestingRollback(String tag, Contexts contexts, LabelExpression labelExpression)
Deprecated.void
updateTestingRollback(Contexts contexts, LabelExpression labelExpression)
Deprecated.void
validate()
Deprecated.useCommandScope
-
-
-
Constructor Detail
-
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
public Liquibase(String changeLogFile, ResourceAccessor resourceAccessor, Database database)
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:
DatabaseConnection
,Database
,ResourceAccessor
-
Liquibase
public Liquibase(DatabaseChangeLog changeLog, ResourceAccessor resourceAccessor, Database database)
-
-
Method Detail
-
getChangeLogFile
public String getChangeLogFile()
Return the change log file used by this Liquibase instance.
-
getLog
public Logger getLog()
Return the log used by this Liquibase instance.
-
getChangeLogParameters
public ChangeLogParameters getChangeLogParameters()
Returns the ChangeLogParameters container used by this Liquibase instance.
-
getDatabase
public Database getDatabase()
Returns the Database used by this Liquibase instance.
-
getResourceAccessor
public ResourceAccessor getResourceAccessor()
Return ResourceAccessor used by this Liquibase instance.
-
update
@Deprecated public void update() throws LiquibaseException
Deprecated.useCommandScope
- Throws:
LiquibaseException
-
update
@Deprecated public void update(String contexts) throws LiquibaseException
Deprecated.useCommandScope
- Throws:
LiquibaseException
-
update
@Deprecated public void update(Contexts contexts) throws LiquibaseException
Deprecated.useCommandScope
- Throws:
LiquibaseException
-
update
@Deprecated public void update(Contexts contexts, LabelExpression labelExpression) throws LiquibaseException
Deprecated.useCommandScope
- Throws:
LiquibaseException
-
update
@Deprecated public void update(Contexts contexts, LabelExpression labelExpression, boolean checkLiquibaseTables) throws LiquibaseException
Deprecated.useCommandScope
- Throws:
LiquibaseException
-
isUpToDateFastCheck
@Deprecated protected boolean isUpToDateFastCheck(Contexts contexts, LabelExpression labelExpression) throws LiquibaseException
Deprecated.this method has been moved toAbstractUpdateCommandStep
, 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
public DatabaseChangeLog getDatabaseChangeLog() throws LiquibaseException
- 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
@Deprecated public void update(String contexts, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
update
@Deprecated public void update(Contexts contexts, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
update
@Deprecated public void update(Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
update
@Deprecated public void update(Contexts contexts, LabelExpression labelExpression, Writer output, boolean checkLiquibaseTables) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
update
@Deprecated public void update(int changesToApply, String contexts) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
update
@Deprecated public void update(int changesToApply, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException
Deprecated.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
@Deprecated public void update(String tag, String contexts) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
update
@Deprecated public void update(String tag, Contexts contexts) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
update
@Deprecated public void update(String tag, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException
Deprecated.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.
-
update
@Deprecated public void update(int changesToApply, String contexts, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
update
@Deprecated public void update(int changesToApply, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
update
@Deprecated public void update(String tag, String contexts, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
update
@Deprecated public void update(String tag, Contexts contexts, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
update
@Deprecated public void update(String tag, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
outputHeader
@Deprecated public void outputHeader(String message) throws DatabaseException
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
public void rollback(int changesToRollback, String contexts) throws LiquibaseException
- 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
@Deprecated public void rollback(String tagToRollBackTo, String contexts, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
rollback
@Deprecated public void rollback(String tagToRollBackTo, Contexts contexts, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
rollback
@Deprecated public void rollback(String tagToRollBackTo, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
rollback
@Deprecated public void rollback(String tagToRollBackTo, String rollbackScript, String contexts, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
rollback
@Deprecated public void rollback(String tagToRollBackTo, String rollbackScript, Contexts contexts, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
rollback
@Deprecated public void rollback(String tagToRollBackTo, String rollbackScript, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
rollback
@Deprecated public void rollback(String tagToRollBackTo, String contexts) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
rollback
@Deprecated public void rollback(String tagToRollBackTo, Contexts contexts) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
rollback
@Deprecated public void rollback(String tagToRollBackTo, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
rollback
@Deprecated public void rollback(String tagToRollBackTo, String rollbackScript, String contexts) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
rollback
@Deprecated public void rollback(String tagToRollBackTo, String rollbackScript, Contexts contexts) throws LiquibaseException
Deprecated.- 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
public void rollback(Date dateToRollBackTo, String contexts) throws LiquibaseException
- 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
public void changeLogSync(String contexts, Writer output) throws LiquibaseException
- Throws:
LiquibaseException
-
changeLogSync
public void changeLogSync(Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException
- Throws:
LiquibaseException
-
changeLogSync
public void changeLogSync(String contexts) throws LiquibaseException
- Throws:
LiquibaseException
-
changeLogSync
@Deprecated public void changeLogSync(Contexts contexts) throws LiquibaseException
Deprecated.use version with LabelExpression- Throws:
LiquibaseException
-
changeLogSync
public void changeLogSync(Contexts contexts, LabelExpression labelExpression) throws LiquibaseException
- Throws:
LiquibaseException
-
changeLogSync
public void changeLogSync(String tag, String contexts) throws LiquibaseException
- 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
public void changeLogSync(String tag, String contexts, Writer output) throws LiquibaseException
- Throws:
LiquibaseException
-
changeLogSync
public void changeLogSync(String tag, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException
- Throws:
LiquibaseException
-
markNextChangeSetRan
@Deprecated public void markNextChangeSetRan(String contexts, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
markNextChangeSetRan
@Deprecated public void markNextChangeSetRan(Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
markNextChangeSetRan
@Deprecated public void markNextChangeSetRan(String contexts) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
markNextChangeSetRan
@Deprecated public void markNextChangeSetRan(Contexts contexts, LabelExpression labelExpression) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
futureRollbackSQL
@Deprecated public void futureRollbackSQL(String contexts, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
futureRollbackSQL
@Deprecated public void futureRollbackSQL(Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
futureRollbackSQL
@Deprecated public void futureRollbackSQL(String contexts, Writer output, boolean checkLiquibaseTables) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
futureRollbackSQL
@Deprecated public void futureRollbackSQL(Integer count, String contexts, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
futureRollbackSQL
@Deprecated public void futureRollbackSQL(Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
futureRollbackSQL
@Deprecated public void futureRollbackSQL(Integer count, String contexts, Writer output, boolean checkLiquibaseTables) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
futureRollbackSQL
@Deprecated public void futureRollbackSQL(Integer count, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
futureRollbackSQL
@Deprecated public void futureRollbackSQL(Integer count, Contexts contexts, LabelExpression labelExpression, Writer output, boolean checkLiquibaseTables) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
futureRollbackSQL
@Deprecated public void futureRollbackSQL(String tag, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
futureRollbackSQL
@Deprecated protected void futureRollbackSQL(Integer count, String tag, Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
futureRollbackSQL
@Deprecated protected void futureRollbackSQL(Integer count, String tag, Contexts contexts, LabelExpression labelExpression, Writer output, boolean checkLiquibaseTables) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
resetServices
protected void resetServices()
-
dropAll
public final void dropAll() throws DatabaseException
Drops all database objects in the default schema.- Throws:
DatabaseException
-
dropAll
public final void dropAll(Boolean dropDbclhistory) throws DatabaseException
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
public final void dropAll(CatalogAndSchema... schemas) throws DatabaseException
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
@Deprecated public void tag(String tagString) throws LiquibaseException
Deprecated.UseCommandScope(String)
to tag instead of this method.'Tags' the database for future rollback- Throws:
LiquibaseException
-
tagExists
@Deprecated public boolean tagExists(String tagString) throws LiquibaseException
Deprecated.Use {linkCommandScope(String)
to verify tag exist instead of this method.Verifies if a given tag exist in the database- Throws:
LiquibaseException
-
updateTestingRollback
@Deprecated public void updateTestingRollback(String contexts) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
updateTestingRollback
@Deprecated public void updateTestingRollback(Contexts contexts, LabelExpression labelExpression) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
updateTestingRollback
@Deprecated public void updateTestingRollback(String tag, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
checkLiquibaseTables
public void checkLiquibaseTables(boolean updateExistingNullChecksums, DatabaseChangeLog databaseChangeLog, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException
- Throws:
LiquibaseException
-
isSafeToRunUpdate
public boolean isSafeToRunUpdate() throws DatabaseException
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
@Deprecated public DatabaseChangeLogLock[] listLocks() throws LiquibaseException
Deprecated.Display change log lock information.- Throws:
LiquibaseException
-
reportLocks
@Deprecated public void reportLocks(PrintStream out) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
forceReleaseLocks
public void forceReleaseLocks() throws LiquibaseException
- Throws:
LiquibaseException
-
listUnrunChangeSets
@Deprecated public List<ChangeSet> listUnrunChangeSets(Contexts contexts) throws LiquibaseException
Deprecated.use version with LabelExpression- Throws:
LiquibaseException
-
listUnrunChangeSets
@Deprecated public List<ChangeSet> listUnrunChangeSets(Contexts contexts, LabelExpression labels) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
listUnrunChangeSets
@Deprecated public List<ChangeSet> listUnrunChangeSets(Contexts contexts, LabelExpression labels, boolean checkLiquibaseTables) throws LiquibaseException
Deprecated.- 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
@Deprecated public void reportStatus(boolean verbose, String contexts, Writer out) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
reportStatus
@Deprecated public void reportStatus(boolean verbose, Contexts contexts, Writer out) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
reportStatus
@Deprecated public void reportStatus(boolean verbose, Contexts contexts, LabelExpression labels, Writer out) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
listUnexpectedChangeSets
@Deprecated public Collection<RanChangeSet> listUnexpectedChangeSets(String contexts) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
listUnexpectedChangeSets
@Deprecated public Collection<RanChangeSet> listUnexpectedChangeSets(Contexts contexts, LabelExpression labelExpression) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
reportUnexpectedChangeSets
@Deprecated public void reportUnexpectedChangeSets(boolean verbose, String contexts, Writer out) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
reportUnexpectedChangeSets
@Deprecated public void reportUnexpectedChangeSets(boolean verbose, Contexts contexts, LabelExpression labelExpression, Writer out) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
clearCheckSums
@Deprecated public void clearCheckSums() throws LiquibaseException
Deprecated.UseCommandScope(String)
Sets checksums to null, so they will be repopulated next run- Throws:
LiquibaseException
-
calculateCheckSum
@Deprecated public final CheckSum calculateCheckSum(String changeSetIdentifier) throws LiquibaseException
Deprecated.Use {linkCommandScope(String)
.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
@Deprecated public void generateDocumentation(String outputDirectory) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
generateDocumentation
@Deprecated public void generateDocumentation(String outputDirectory, String contexts) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
generateDocumentation
@Deprecated public void generateDocumentation(String outputDirectory, String contexts, CatalogAndSchema... schemaList) throws LiquibaseException
Deprecated.- Throws:
LiquibaseException
-
generateDocumentation
@Deprecated public void generateDocumentation(String outputDirectory, Contexts contexts, LabelExpression labelExpression, CatalogAndSchema... schemaList) throws LiquibaseException
Deprecated.UseCommandScope
to generate dbDoc instead of this method.- Throws:
LiquibaseException
-
diff
@Deprecated public DiffResult diff(Database referenceDatabase, Database targetDatabase, CompareControl compareControl) throws LiquibaseException
Deprecated.Use {linkCommandScope(String)
to generate diff instead of this method.- Throws:
LiquibaseException
-
validate
@Deprecated public void validate() throws LiquibaseException
Deprecated.useCommandScope
Checks changelogs for bad MD5Sums and preconditions before attempting a migration- Throws:
LiquibaseException
-
setChangeExecListener
public void setChangeExecListener(ChangeExecListener listener)
-
getDefaultChangeExecListener
public DefaultChangeExecListener getDefaultChangeExecListener()
-
setShowSummary
public void setShowSummary(UpdateSummaryEnum showSummary)
-
setShowSummaryOutput
public void setShowSummaryOutput(UpdateSummaryOutputEnum showSummaryOutput)
-
generateChangeLog
@Deprecated @SafeVarargs public final void generateChangeLog(CatalogAndSchema catalogAndSchema, DiffToChangeLog changeLogWriter, PrintStream outputStream, Class<? extends DatabaseObject>... snapshotTypes) throws DatabaseException, CommandExecutionException
Deprecated.Use {linkCommandScope(String)
to generateChangelog instead of this method.
-
generateChangeLog
@Deprecated @SafeVarargs public final void generateChangeLog(CatalogAndSchema catalogAndSchema, DiffToChangeLog changeLogWriter, PrintStream outputStream, ChangeLogSerializer changeLogSerializer, Class<? extends DatabaseObject>... snapshotTypes) throws DatabaseException, CommandExecutionException
Deprecated.Use {linkCommandScope(String)
to generateChangelog instead of this method.
-
close
public void close() throws LiquibaseException
- Specified by:
close
in interfaceAutoCloseable
- Throws:
LiquibaseException
-
-