What is a rollback?
Last updated: July 31, 2025
Liquibase provides commands to allow you to undo changes you have made to your database, either automatically or with a custom rollback command. A rollback script returns the database to a previous specified point in time.
Note: Rollback support is available in the command line, Ant, and Maven.
Rollback commands
There are three rollback modes:
Command | Description |
rollback | This command will revert all changes made to the database after the specified tag. It is used when you want to undo a series of changes related to a specific tag, such as a numbered release. |
rollback-to-date | This command is used to revert all changes made to the database from the current date to the date and time you specify. There are several ways to revert your changes with the There are three options: You can use Examples: |
rollback-count | This command is used to roll back a specified number of changesets, where |
Liquibase Pro rollback commands
Liquibase Pro contains additional built-in commands that allow you to perform targeted rollback tasks.
Command | Description |
rollback-one-changeset | This command will revert one non-sequential changeset made during a previous database change without affecting any other changes made to your database. |
rollback-one-update | This command will revert all changesets related to a specific |
Rollback on error
In Liquibase Pro 4.18.0 and later, you can use the command parameter --rollback-on-error
with the following commands: update
, update-count
, update-one-changeset
, update-testing-rollback
, and update-to-tag
. If you set --rollback-on-error
to true
, then Liquibase automatically rolls back any changesets that cause errors when you try to deploy them. See also: failOnError
.
Validating rollbacks
Rollback scripts are one of the most challenging aspects of application development to create and maintain, especially when data is modified.
If the database change is simple, such as adding a new index or updating a stored procedure, then the rollback is straightforward.
Rolling back complex changes that involve structural changes and data migration is more difficult.
So, before performing a rollback, it is important to validate the changes Liquibase will run before making the change to the database. These two commands help validate and test rollbacks.
Command | Description |
update-testing-rollback | This command is used to test rollback functionality when deploying changesets in your changelog sequentially. It tests the rollback by deploying all pending changesets, executing a sequential rollback in reverse order for the deployed changes, then running the update again. |
future-rollback-sql | This command produces the raw SQL that Liquibase would use to revert changes associated with undeployed changesets. It is used when auditors need to verify that all database changes have a rollback. |
Rollbacks are also validated with the help of SQL helper commands:
Command | Description |
rollback-sql | This helper command is used in conjunction with the |
future-rollback-from-tag-sql | This helper command produces the raw SQL Liquibase would need to roll back all undeployed changes made up to the specified tag. |
rollback-to-date-sql | This helper command is used in conjunction with the |
update-count-sql | This helper command is used in conjunction with the |
Pro Command | Description |
rollback-one-changeset-sql | This helper command is used in conjunction with the |
rollback-one-update-sql | This helper command is used in conjunction with the |
Rollback test cycle
Rollback scripts need to be tested just like application code, so we know they work as designed.
You will need to test your rollback scripts carefully. This includes determining who will test the rollback script, ho,w and when they will be tested.
A complete test cycle should include:
Deploying all changes to the database and validating that they were deployed.
Rolling back all changes to the database, validating that all changes were reversed, and verifying that the database was brought back to the previous state.
Redeploying all changes to the database. This is required to verify that the rollback did not miss any changes that could impact a future deployment.