Package liquibase.command.core
Class AbstractUpdateCommandStep
java.lang.Object
liquibase.command.AbstractCommandStep
liquibase.command.core.AbstractUpdateCommandStep
- All Implemented Interfaces:
CleanUpCommandStep
,CommandStep
- Direct Known Subclasses:
UpdateCommandStep
,UpdateCountCommandStep
,UpdateSqlCommandStep
,UpdateToTagCommandStep
public abstract class AbstractUpdateCommandStep
extends AbstractCommandStep
implements CleanUpCommandStep
-
Field Summary
Fields inherited from class liquibase.command.AbstractCommandStep
coreBundle
Fields inherited from interface liquibase.command.CommandStep
ORDER_DEFAULT, ORDER_NOT_APPLICABLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanUp
(CommandResultsBuilder resultsBuilder) Method invoked to execute the cleanup action.protected void
customMdcLogging
(CommandScope commandScope) abstract String
getChangelogFileArg
(CommandScope commandScope) abstract String[]
abstract String
getContextsArg
(CommandScope commandScope) abstract String
getLabelFilterArg
(CommandScope commandScope) abstract UpdateSummaryEnum
getShowSummary
(CommandScope commandScope) getShowSummaryOutput
(CommandScope commandScope) getStandardChangelogIterator
(CommandScope commandScope, Database database, Contexts contexts, LabelExpression labelExpression, DatabaseChangeLog changeLog) protected List<ChangeSetFilter>
getStandardChangelogIteratorFilters
(Database database, Contexts contexts, LabelExpression labelExpression) getStatusChangelogIterator
(CommandScope commandScope, Database database, Contexts contexts, LabelExpression labelExpression, DatabaseChangeLog changeLog) boolean
isUpToDate
(CommandScope commandScope, Database database, DatabaseChangeLog databaseChangeLog, Contexts contexts, LabelExpression labelExpression, OutputStream outputStream) Checks if the database is up-to-date.void
postUpdateLog
(int rowsAffected) Deprecated.void
postUpdateLog
(int rowsAffected, List<ChangeSet> exceptionChangeSets) Generate post update log messagesprotected void
postUpdateLogForActualUpdate
(int rowsAffected, List<ChangeSet> exceptionChangeSets, String messageWithRowCount, String messageWithoutRowCount) Generic method called by all Update commands that actually apply the change to the database (ie !protected void
preRun
(CommandScope commandScope, ChangeLogIterator runChangeLogIterator, ChangeLogParameters changeLogParameters) Executed before running any updates against the database.Return a list of configured Classes that this command requires to be passed as a dependency.void
run
(CommandResultsBuilder resultsBuilder) Performs the business logic.protected void
setDBLock
(boolean locked) void
setFastCheckEnabled
(boolean fastCheckEnabled) Methods inherited from class liquibase.command.AbstractCommandStep
adjustCommandDefinition, getOrder, providedDependencies, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface liquibase.command.CommandStep
defineCommandNames
-
Field Details
-
DEFAULT_CHANGE_EXEC_LISTENER_RESULT_KEY
- See Also:
-
-
Constructor Details
-
AbstractUpdateCommandStep
public AbstractUpdateCommandStep()
-
-
Method Details
-
getChangelogFileArg
-
getContextsArg
-
getLabelFilterArg
-
getCommandName
-
getShowSummary
-
getShowSummaryOutput
-
requiredDependencies
Description copied from interface:CommandStep
Return a list of configured Classes that this command requires to be passed as a dependency.- Specified by:
requiredDependencies
in interfaceCommandStep
- Overrides:
requiredDependencies
in classAbstractCommandStep
- Returns:
- list with the required classes types
-
run
Description copied from interface:CommandStep
Performs the business logic. This method should not be called directly. It is called by the overall pipeline logic in theCommandScope.execute()
order.- Specified by:
run
in interfaceCommandStep
- Throws:
Exception
-
preRun
protected void preRun(CommandScope commandScope, ChangeLogIterator runChangeLogIterator, ChangeLogParameters changeLogParameters) throws LiquibaseException Executed before running any updates against the database.- Throws:
LiquibaseException
-
customMdcLogging
-
cleanUp
Description copied from interface:CleanUpCommandStep
Method invoked to execute the cleanup action.- Specified by:
cleanUp
in interfaceCleanUpCommandStep
- Parameters:
resultsBuilder
- builder used in this pipeline
-
getStandardChangelogIterator
@Beta public ChangeLogIterator getStandardChangelogIterator(CommandScope commandScope, Database database, Contexts contexts, LabelExpression labelExpression, DatabaseChangeLog changeLog) throws LiquibaseException - Throws:
LiquibaseException
-
getStatusChangelogIterator
@Beta public ChangeLogIterator getStatusChangelogIterator(CommandScope commandScope, Database database, Contexts contexts, LabelExpression labelExpression, DatabaseChangeLog changeLog) throws LiquibaseException - Throws:
LiquibaseException
-
getStandardChangelogIteratorFilters
protected List<ChangeSetFilter> getStandardChangelogIteratorFilters(Database database, Contexts contexts, LabelExpression labelExpression) -
isUpToDate
@Beta public boolean isUpToDate(CommandScope commandScope, Database database, DatabaseChangeLog databaseChangeLog, Contexts contexts, LabelExpression labelExpression, OutputStream outputStream) throws LiquibaseException, IOException Checks if the database is up-to-date.- Parameters:
commandScope
-database
- the database to checkdatabaseChangeLog
- the databaseChangeLog of the databasecontexts
- the command contextslabelExpression
- the command label expressionsoutputStream
- the current global OutputStream- Returns:
- true if there are no additional changes to execute, otherwise false
- Throws:
LiquibaseException
- if there was a problem running any queriesIOException
- if there was a problem handling the update summary
-
setFastCheckEnabled
public void setFastCheckEnabled(boolean fastCheckEnabled) -
postUpdateLog
Generate post update log messages- Parameters:
rowsAffected
- # of rows affectedexceptionChangeSets
- list of changesets that failed
-
postUpdateLogForActualUpdate
protected void postUpdateLogForActualUpdate(int rowsAffected, List<ChangeSet> exceptionChangeSets, String messageWithRowCount, String messageWithoutRowCount) Generic method called by all Update commands that actually apply the change to the database (ie !update-sql)- Parameters:
rowsAffected
- # of rows affectedexceptionChangeSets
- list of changesets that failedmessageWithRowCount
- message to display when rowsAffected > -1messageWithoutRowCount
- message to display when rowsAffected == -1
-
postUpdateLog
Deprecated.UsepostUpdateLog(int, List)
instead -
setDBLock
protected void setDBLock(boolean locked)
-
postUpdateLog(int, List)
instead