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
FieldsFields inherited from class liquibase.command.AbstractCommandStep
coreBundleFields inherited from interface liquibase.command.CommandStep
ORDER_DEFAULT, ORDER_NOT_APPLICABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanUp(CommandResultsBuilder resultsBuilder) Method invoked to execute the cleanup action.protected voidcustomMdcLogging(CommandScope commandScope) abstract StringgetChangelogFileArg(CommandScope commandScope) abstract String[]abstract StringgetContextsArg(CommandScope commandScope) abstract StringgetLabelFilterArg(CommandScope commandScope) abstract UpdateSummaryEnumgetShowSummary(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) booleanisUpToDate(CommandScope commandScope, Database database, DatabaseChangeLog databaseChangeLog, Contexts contexts, LabelExpression labelExpression, OutputStream outputStream) Checks if the database is up-to-date.voidpostUpdateLog(int rowsAffected) Deprecated.voidpostUpdateLog(int rowsAffected, List<ChangeSet> exceptionChangeSets) Generate post update log messagesprotected voidpostUpdateLogForActualUpdate(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 voidpreRun(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.voidrun(CommandResultsBuilder resultsBuilder) Performs the business logic.protected voidsetDBLock(boolean locked) voidsetFastCheckEnabled(boolean fastCheckEnabled) Methods inherited from class liquibase.command.AbstractCommandStep
adjustCommandDefinition, getOrder, handleOutput, providedDependencies, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface liquibase.command.CommandStep
defineCommandNames, isInternal
-
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:CommandStepReturn a list of configured Classes that this command requires to be passed as a dependency.- Specified by:
requiredDependenciesin interfaceCommandStep- Overrides:
requiredDependenciesin classAbstractCommandStep- Returns:
- list with the required classes types
-
run
Description copied from interface:CommandStepPerforms the business logic. This method should not be called directly. It is called by the overall pipeline logic in theCommandScope.execute()order.- Specified by:
runin 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:CleanUpCommandStepMethod invoked to execute the cleanup action.- Specified by:
cleanUpin 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