Package org.liquibase.maven.plugins
Class LiquibaseRollback
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.liquibase.maven.plugins.AbstractLiquibaseMojo
-
- org.liquibase.maven.plugins.AbstractLiquibaseChangeLogMojo
-
- org.liquibase.maven.plugins.LiquibaseRollback
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
LiquibaseFutureRollbackSQL,LiquibaseRollbackSQL
public class LiquibaseRollback extends AbstractLiquibaseChangeLogMojo
Invokes Liquibase to rollback the database (and mark changesets as unapplied). The changesets to be rolled back are specified using attributes 'rollbackCount', 'rollbackTag' and/or 'rollbackDate'
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classLiquibaseRollback.RollbackType
-
Field Summary
Fields Modifier and Type Field Description protected introllbackCountThe number of changesets to rollback.protected StringrollbackDateThe date to rollback the database to.protected StringrollbackScriptExternal script containing rollback logic.protected StringrollbackTagThe tag to roll the database back to.protected LiquibaseRollback.RollbackTypetypeThe type of the rollback that is being performed.-
Fields inherited from class org.liquibase.maven.plugins.AbstractLiquibaseChangeLogMojo
changeLogDirectory, changeLogFile, contexts, duplicateFileMode, labelFilter, labels
-
Fields inherited from class org.liquibase.maven.plugins.AbstractLiquibaseMojo
changeExecListenerClass, changeExecListenerPropertiesFile, changelogCatalogName, changelogSchemaName, clearCheckSums, commandName, databaseChangelogHistoryCaptureExtensions, databaseChangelogHistoryCaptureSql, databaseChangelogHistoryEnabled, databaseChangeLogLockTableName, databaseChangeLogTableName, databaseClass, dbclHistoryCaptureExtensions, dbclHistoryCaptureSql, dbclHistoryEnabled, defaultCatalogName, defaultChangeExecListener, defaultSchemaName, driver, emptyPassword, includeArtifact, includeTestOutputDirectory, logFormat, logging, logLevel, mojoExecution, outputDefaultCatalog, outputDefaultSchema, outputFileEncoding, password, preserveSchemaCase, project, promptOnNonLocalDatabase, propertyFile, propertyFileWillOverride, propertyProviderClass, psqlArgs, psqlKeepTemp, psqlKeepTempName, psqlKeepTempPath, psqlLogFile, psqlPath, psqlTimeout, searchPath, session, showBanner, skip, skipOnFileExists, sqlcmdArgs, sqlcmdCatalogName, sqlcmdKeepTemp, sqlcmdKeepTempName, sqlcmdKeepTempOverwrite, sqlcmdKeepTempPath, sqlcmdLogFile, sqlcmdPath, sqlcmdTimeout, sqlPlusArgs, sqlPlusKeepTemp, sqlPlusKeepTempName, sqlPlusKeepTempOverwrite, sqlPlusKeepTempPath, sqlPlusLogFile, sqlPlusPath, sqlPlusTimeout, systemProperties, url, username, verbose, wagonManager
-
-
Constructor Summary
Constructors Constructor Description LiquibaseRollback()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckRequiredParametersAreSpecified()Performs some validation after the properties file has been loaded checking that all properties required have been specified.protected voidcheckRequiredRollbackParameters()protected DateparseDate(String date)protected voidperformLiquibaseTask(Liquibase liquibase)Performs the actual Liquibase task on the database using the fully configuredLiquibase.protected voidprintSettings(String indent)Prints the settings that have been set of defaulted for the plugin.-
Methods inherited from class org.liquibase.maven.plugins.AbstractLiquibaseChangeLogMojo
createLiquibase, getLabelFilter, getResourceAccessor
-
Methods inherited from class org.liquibase.maven.plugins.AbstractLiquibaseMojo
cleanup, configureChangeLogProperties, configureFieldsAndValues, databaseConnectionRequired, execute, getClassLoaderIncludingProjectClasspath, getField, getLicenseKey, getLiquibase, getLog, getMavenArtifactClassLoader, getOutputStream, getOutputWriter, isPromptOnNonLocalDatabase, parsePropertiesFile, setPassword, setupBindInfoPackage, setUrl, setUsername
-
-
-
-
Field Detail
-
rollbackTag
protected String rollbackTag
The tag to roll the database back to.
-
rollbackCount
protected int rollbackCount
The number of changesets to rollback.
-
rollbackDate
protected String rollbackDate
The date to rollback the database to. The format of the date must match either an ISO date format, or that of theDateFormat.getDateInstance()for the platform the plugin is executing on.
-
type
protected LiquibaseRollback.RollbackType type
The type of the rollback that is being performed.
-
rollbackScript
protected String rollbackScript
External script containing rollback logic. Set to override the rollback logic contained in the changelog
-
-
Method Detail
-
checkRequiredParametersAreSpecified
protected void checkRequiredParametersAreSpecified() throws org.apache.maven.plugin.MojoFailureExceptionDescription copied from class:AbstractLiquibaseMojoPerforms some validation after the properties file has been loaded checking that all properties required have been specified.- Overrides:
checkRequiredParametersAreSpecifiedin classAbstractLiquibaseChangeLogMojo- Throws:
org.apache.maven.plugin.MojoFailureException- If any property that is required has not been specified.
-
checkRequiredRollbackParameters
protected void checkRequiredRollbackParameters() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
printSettings
protected void printSettings(String indent)
Description copied from class:AbstractLiquibaseMojoPrints the settings that have been set of defaulted for the plugin. These will only be shown in verbose mode.- Overrides:
printSettingsin classAbstractLiquibaseChangeLogMojo- Parameters:
indent- The indent string to use when printing the settings.
-
performLiquibaseTask
protected void performLiquibaseTask(Liquibase liquibase) throws LiquibaseException
Description copied from class:AbstractLiquibaseChangeLogMojoPerforms the actual Liquibase task on the database using the fully configuredLiquibase.- Overrides:
performLiquibaseTaskin classAbstractLiquibaseChangeLogMojo- Parameters:
liquibase- TheLiquibasethat has been fully configured to run the desired database task.- Throws:
LiquibaseException
-
parseDate
protected Date parseDate(String date) throws ParseException
- Throws:
ParseException
-
-