Maven updateTestingRollback
updateTestingRollback
tests rollback support by deploying all pending changesets to the database, executes a rollback sequentially for the equal number of changesets that were deployed, and then runs the update again deploying all changesets to the database.
Uses
updateTestingRollback
is typically used when you want to test rollback functionality when deploying changesets in your changelog sequentially. Run this command only when all pending changelogs have been verified as ready to be deployed as you cannot specify changesets to exclude.
updateTestingRollback
utilizes a multi-step operation and runs in sequential order:
- update changeset1; update changeset2; update changeset3
- rollback changeset3; rollback changeset2; rollback changeset1
- update changeset1; update changeset2 update changeset3
Note: If you use the earlier versions of Liquibase, the order of operations may differ.
If any of the changesets fail rollback, changesets that come after the failed changesets will not be tested or updated. Any changesets that come before the failed changesets will be deployed to the database.
Maven configuration
You can configure Liquibase Maven in multiple ways. You can pass arguments like <changeLogFile>
in Maven directly in your pom.xml
file, in a liquibase.properties
file referenced in your POM, as environment variables, or as JVM system properties.
Tip: For more information about the Maven configuration, see Configuring Maven.
Running the updateTestingRollback
Maven goal
Running the updateTestingRollback
goal requires a Maven project to be implemented.
To run the goal, type the following in your command prompt:
mvn liquibase:updateTestingRollback
When successful, the updateTestingRollback
Maven goal produces the following output:
[INFO] Scanning for projects...
Downloading from plugins-release: https://artifactory.datical.net:80/artifactory/plugins-release/org/eclipse/m2e/lifecycle-mapping/1.0.0/lifecycle-mapping-1.0.0.pom
Downloading from libs-snapshot-local: http://artifactory.datical.net:80/artifactory/libs-snapshot-local/org/eclipse/m2e/lifecycle-mapping/1.0.0/lifecycle-mapping-1.0.0.pom
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0
[INFO]
[INFO] -------------------< com.example:liquibase-project >--------------------
[INFO] Building liquibase-project 05XII19
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0
[INFO]
[INFO] --- liquibase-maven-plugin:3.8.9:updateTestingRollback (default-cli) @ liquibase-project ---
[INFO] ------------------------------------------------------------------------
[INFO] Parsing Liquibase Properties File
[INFO] File: C:\Users\Administrator\git\Maven Projects\Maven Projects\my-liquibase-app/local.liquibase.properties
[INFO] ------------------------------------------------------------------------
[INFO] Successfully installed license from Base64 string starting with 'ABwwGgQUxS' (property liquibaseProLicenseKey).
[INFO] Liquibase Pro 3.8.9 by Liquibase licensed to Liquibase Pro Customer until Tue Nov 03 19:00:00 CST 2020
[INFO] Liquibase Pro 3.8.9 by Liquibase licensed to Liquibase Pro Customer until Tue Nov 03 19:00:00 CST 2020
[INFO] Starting Liquibase at Thu, 25 Jun 2020 15:51:47 CDT (version 3.8.9 #73 built at Mon Apr 06 09:32:58 UTC 2020)
[INFO] Parsing Liquibase Properties File C:\Users\Administrator\git\Maven Projects\Maven Projects\my-liquibase-app/local.liquibase.properties for changeLog parameters
[INFO] Executing on Database: jdbc:oracle:thin:@localhost:1521:ORCL
[INFO] SELECT COUNT(*) FROM DATABASECHANGELOGLOCK
[INFO] SELECT COUNT(*) FROM DATABASECHANGELOGLOCK
[INFO] SELECT LOCKED FROM DATABASECHANGELOGLOCK WHERE ID=1 FOR UPDATE
[INFO] Successfully acquired change log lock
[INFO] SELECT MD5SUM FROM DATABASECHANGELOG WHERE MD5SUM IS NOT NULL AND ROWNUM=1
[INFO] SELECT COUNT(*) FROM DATABASECHANGELOG
[INFO] Reading from DATABASECHANGELOG
[INFO] SELECT * FROM DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
[INFO] CREATE TABLE "table-test2" (ID NUMBER(*, 0))
[INFO] Table table-test2 created
[INFO] ChangeSet dbchangelog.xml::1581384383517-8::support.liquibase.net (generated) ran successfully in 10ms
[INFO] SELECT MAX(ORDEREXECUTED) FROM DATABASECHANGELOG
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('1581384383517-8', 'support.liquibase.net (generated)', 'dbchangelog.xml', SYSTIMESTAMP, 13, '8:95fb0041973fb61b50176ff311801ba5', 'createTable tableName=table-test2', '', 'EXECUTED', NULL, NULL, '3.8.9', '3118309907')
[INFO] CREATE TABLE "table-test3" (ID NUMBER(*, 0))
[INFO] Table table-test3 created
[INFO] ChangeSet dbchangelog.xml::1581384383517-9::support.liquibase.net (generated) ran successfully in 6ms
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('1581384383517-9', 'support.liquibase.net (generated)', 'dbchangelog.xml', SYSTIMESTAMP, 14, '8:b6d3ea5cf13ef90d38d060b0d2f85479', 'createTable tableName=table-test3', '', 'EXECUTED', NULL, NULL, '3.8.9', '3118309907')
[INFO] CREATE TABLE "table-test4" (ID NUMBER(*, 0))
[INFO] Table table-test4 created
[INFO] ChangeSet dbchangelog.xml::1581384383517-10::support.liquibase.net (generated) ran successfully in 6ms
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('1581384383517-10', 'support.liquibase.net (generated)', 'dbchangelog.xml', SYSTIMESTAMP, 15, '8:35b2696a631d46f6a2715466e8a4043e', 'createTable tableName=table-test4', '', 'EXECUTED', NULL, NULL, '3.8.9', '3118309907')
[INFO] CREATE TABLE T_TABLE1000 (ID NUMBER(*, 0) NOT NULL, NAME VARCHAR2(20 BYTE), REGION VARCHAR2(20 BYTE), MARKET VARCHAR2(20 BYTE))
[INFO] Table T_TABLE1000 created
[INFO] ChangeSet dbchangelog.xml::15813::TsviZ ran successfully in 7ms
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('15813', 'TsviZ', 'dbchangelog.xml', SYSTIMESTAMP, 16, '8:2976d48b6ef8319cd030a74a3e9c533d', 'createTable tableName=T_TABLE1000', '', 'EXECUTED', NULL, NULL, '3.8.9', '3118309907')
[INFO] Successfully released change log lock
[INFO] SELECT COUNT(*) FROM DATABASECHANGELOGLOCK
[INFO] SELECT COUNT(*) FROM DATABASECHANGELOGLOCK
[INFO] SELECT LOCKED FROM DATABASECHANGELOGLOCK WHERE ID=1 FOR UPDATE
[INFO] Successfully acquired change log lock
[INFO] SELECT MD5SUM FROM DATABASECHANGELOG WHERE MD5SUM IS NOT NULL AND ROWNUM=1
[INFO] SELECT COUNT(*) FROM DATABASECHANGELOG
[INFO] Reading from DATABASECHANGELOG
[INFO] SELECT * FROM DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
[INFO] Rolling Back Changeset:dbchangelog.xml::15813::TsviZ
[INFO] DROP TABLE T_TABLE1000
[INFO] DELETE FROM DATABASECHANGELOG WHERE ID = '15813' AND AUTHOR = 'TsviZ' AND FILENAME = 'dbchangelog.xml'
[INFO] Rolling Back Changeset:dbchangelog.xml::1581384383517-10::support.liquibase.net (generated)
[INFO] DROP TABLE "table-test4"
[INFO] DELETE FROM DATABASECHANGELOG WHERE ID = '1581384383517-10' AND AUTHOR = 'support.liquibase.net (generated)' AND FILENAME = 'dbchangelog.xml'
[INFO] Rolling Back Changeset:dbchangelog.xml::1581384383517-9::support.liquibase.net (generated)
[INFO] DROP TABLE "table-test3"
[INFO] DELETE FROM DATABASECHANGELOG WHERE ID = '1581384383517-9' AND AUTHOR = 'support.liquibase.net (generated)' AND FILENAME = 'dbchangelog.xml'
[INFO] Rolling Back Changeset:dbchangelog.xml::1581384383517-8::support.liquibase.net (generated)
[INFO] DROP TABLE "table-test2"
[INFO] DELETE FROM DATABASECHANGELOG WHERE ID = '1581384383517-8' AND AUTHOR = 'support.liquibase.net (generated)' AND FILENAME = 'dbchangelog.xml'
[INFO] Successfully released change log lock
[INFO] SELECT COUNT(*) FROM DATABASECHANGELOGLOCK
[INFO] SELECT COUNT(*) FROM DATABASECHANGELOGLOCK
[INFO] SELECT LOCKED FROM DATABASECHANGELOGLOCK WHERE ID=1 FOR UPDATE
[INFO] Successfully acquired change log lock
[INFO] SELECT MD5SUM FROM DATABASECHANGELOG WHERE MD5SUM IS NOT NULL AND ROWNUM=1
[INFO] SELECT COUNT(*) FROM DATABASECHANGELOG
[INFO] Reading from DATABASECHANGELOG
[INFO] SELECT * FROM DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
[INFO] CREATE TABLE "table-test2" (ID NUMBER(*, 0))
[INFO] Table table-test2 created
[INFO] ChangeSet dbchangelog.xml::1581384383517-8::support.liquibase.net (generated) ran successfully in 5ms
[INFO] SELECT MAX(ORDEREXECUTED) FROM DATABASECHANGELOG
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('1581384383517-8', 'support.liquibase.net (generated)', 'dbchangelog.xml', SYSTIMESTAMP, 13, '8:95fb0041973fb61b50176ff311801ba5', 'createTable tableName=table-test2', '', 'EXECUTED', NULL, NULL, '3.8.9', '3118310306')
[INFO] CREATE TABLE "table-test3" (ID NUMBER(*, 0))
[INFO] Table table-test3 created
[INFO] ChangeSet dbchangelog.xml::1581384383517-9::support.liquibase.net (generated) ran successfully in 7ms
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('1581384383517-9', 'support.liquibase.net (generated)', 'dbchangelog.xml', SYSTIMESTAMP, 14, '8:b6d3ea5cf13ef90d38d060b0d2f85479', 'createTable tableName=table-test3', '', 'EXECUTED', NULL, NULL, '3.8.9', '3118310306')
[INFO] CREATE TABLE "table-test4" (ID NUMBER(*, 0))
[INFO] Table table-test4 created
[INFO] ChangeSet dbchangelog.xml::1581384383517-10::support.liquibase.net (generated) ran successfully in 12ms
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('1581384383517-10', 'support.liquibase.net (generated)', 'dbchangelog.xml', SYSTIMESTAMP, 15, '8:35b2696a631d46f6a2715466e8a4043e', 'createTable tableName=table-test4', '', 'EXECUTED', NULL, NULL, '3.8.9', '3118310306')
[INFO] CREATE TABLE T_TABLE1000 (ID NUMBER(*, 0) NOT NULL, NAME VARCHAR2(20 BYTE), REGION VARCHAR2(20 BYTE), MARKET VARCHAR2(20 BYTE))
[INFO] Table T_TABLE1000 created
[INFO] ChangeSet dbchangelog.xml::15813::TsviZ ran successfully in 11ms
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('15813', 'TsviZ', 'dbchangelog.xml', SYSTIMESTAMP, 16, '8:2976d48b6ef8319cd030a74a3e9c533d', 'createTable tableName=T_TABLE1000', '', 'EXECUTED', NULL, NULL, '3.8.9', '3118310306')
[INFO] Successfully released change log lock
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.331 s
[INFO] Finished at: 2020-06-25T15:51:50-05:00
[INFO] ------------------------------------------------------------
------------
updateTestingRollback
optional Maven configuration attributes
Attribute | Definition |
---|---|
liquibase.changeLogDirectory
|
Specifies the path to the directory where Liquibase can find your changelog file. |
liquibase.changeLogFile
|
The changelog file for Liquibase to use. |
liquibase.changelogCatalogName
|
Specifies the catalog Liquibase will use to create your changelog tables. |
liquibase.changelogSchemaName
|
Specifies the schema Liquibase will use to create your changelog tables. |
liquibase.changesToApply
|
Int. Specifies the number of changes to apply to the database. If 0, all changes not already applied to the database are applied. Default value is: 0. |
liquibase.clearCheckSums
|
Boolean. Forces checksums to be cleared from the DATABASECHANGELOG table. Default value is: false. |
liquibase.contexts
|
Specifies which contexts Liquibase will execute, which can be separated by a comma if multiple contexts are required. If a context is not specified, then all contexts will be executed. |
liquibase.databaseChangeLogLockTableName
|
Specifies the table name to use for the DATABASECHANGELOGLOCK table. |
liquibase.databaseChangeLogTableName
|
Specifies the table name to use for the DATABASECHANGELOG table. |
liquibase.databaseClass
|
Specifies the database object class. |
liquibase.defaultCatalogName
|
Specifies the default catalog name to use for the database connection. |
liquibase.defaultSchemaName
|
Specifies the default schema name to use for the database connection. |
liquibase.driver
|
Specifies the driver class name to use for the database connection. |
driverPropertiesFile
|
Specifies the location of a JDBC connection properties file which contains properties the driver will use. |
liquibase.emptyPassword
|
Deprecated. Boolean. Use an empty or null value for the password instead. Default value is: false. |
expressionVariables
|
Specifies a map-based collection of changelog properties to apply. |
expressionVars
|
Specifies a property-based collection of changelog properties to apply. |
liquibase.includeArtifact
|
Boolean. Includes a Maven project artifact in the class loader, which obtains the Liquibase properties file and changelog files. Default value is |
liquibase.includeTestOutputDirectory
|
Boolean. Includes the Maven test output directory in the class loader which obtains the Liquibase properties file and changelog files. Default value is |
liquibase.labels
|
Specifies which labels Liquibase runs, and which can be separated by a comma if multiple labels are required or you need to designate a more complex expression. If no label is specified, then all labels are run. |
liquibase.licenseKey
|
Specifies your Liquibase Pro license key. |
liquibase.outputDefaultCatalog
|
Boolean. Specifies whether to ignore the catalog or database name. Default value is: false. |
liquibase.outputDefaultSchema
|
Boolean. Specifies whether to ignore the schema name. Default value is: false. |
liquibase.outputFileEncoding
|
Indicates that you want to set the character encoding of the output file during the |
liquibase.password
|
Specifies the database password for the database connection. |
liquibase.promptOnNonLocalDatabase
|
Deprecated. Boolean. Controls whether users are prompted before executing changesets to a non-local database. Default value is: true. |
liquibase.propertyFile
|
Specifies the Liquibase properties file to use for configuration, like |
liquibase.propertyFileWillOverride
|
Boolean. Indicates that you want the |
liquibase.propertyProviderClass
|
Specifies the property provider, which must be a |
liquibase.server
|
Specifies the server ID in the Maven |
liquibase.skip
|
Boolean. Specifies whether to skip running Liquibase. The use of this attribute is not recommended but can be used when needed. Default value is: false. |
systemProperties
|
Specifies a list of system properties you want to pass to the database. |
liquibase.toTag
|
Apply changes up to and including the changesets with the given tag goal. |
liquibase.url
|
Specifies the database URL you want to use to execute Liquibase. |
liquibase.username
|
Specifies the database username for the database connection. |
liquibase.verbose
|
Boolean. Controls the amount of output detail when you call the plugin. Default value is: false. |