The rollback command rolls back changes made to the database based on the specified tag.


The rollback command is typically used to revert all changes that were made to the database after the tag you specify.

When you run rollback, Liquibase will roll back sequentially all the deployed changes until it reaches the tag row in the DATABASECHANGELOG table. For example, you can use the rollback command when you want to undo a series of changes made to your database related to a specific tag such as a numbered release. If you have tags for release 1, release 2, and release 3, and need to make a correction in release 2, the rollback command will rollback release 3 first.

The following image shows that if we deploy the createTable C changeset and run the rollback --tag=version1 command to revert changes, Liquibase will roll back only createTable C value:


Using the rollback command comes with risks to your database, so it's important to look for potential unintended consequences before executing this command. You can do this with the rollback-sql command.


To run the rollback command, specify the driver, classpath, and URL in the Liquibase properties file. For more information, see Create and Configure a File. You can also specify these properties in your command line.

Also, before running the rollback command, you need to know the following:

  • If the tag name is unknown to you, you can find it in the DATABASECHANGELOG table.
  • If you don't have any tags specified, you can run the tag command. If you run the tag command to mark the current database state or release, your tag will be applied to the last row in the DATABASECHANGELOG table.
  • If you use the tagDatabase Change Type to create a tag changeset in the changelog file and want to roll back changes applied after this tag, the rollback command will remove all changes made after this tag row and the tag row.
  • If you run the tag command, deploy changesets, and then add the tagDatabase Change Type in your changelog file, your changes and the tag row created by the tagDatabase Change Type will be removed till the command reaches the tag specified with the rollback command.
liquibase rollback --tag=myTag --changelog-file=example-changelog.xml

Note: The --tag=myTag syntax was added in Liquibase 4.4. If you use an older version, specify your tag as a positional argument: <command> myTag.

Command arguments

Tip: For best results, specify all commands and parameters in the --kebab-case format in the CLI. If your preference is camelCase, it also works in the CLI.

Attribute Definition Requirement

The root changelog


The tag identifying which tagged changesets in the changelog to evaluate. Specify as --tag=myTag. Positional format <command> <tag> deprecated in 4.4+.


The JDBC database connection URL. See Using JDBC URL in Liquibase.


Fully-qualified class which specifies a ChangeExecListener


Path to a properties file for the ChangeExecListenerClass


Specifies the changeset contexts to match. Contexts are expressions you can add to changesets to control which changesets are executed in any particular migration run.


Name of the default catalog to use for the database connection


Name of the default schema to use for the database connection. If defaultSchemaName is set, then objects do not have to be fully qualified. This means you can refer to just mytable instead of myschema.mytable.

Tip: In Liquibase v4.23.0+, camelCase for defaultSchemaName works successfully. If you are on an earlier version, camelCase may not work as expected.

Note: The syntax liquibase.command.defaultSchemaName is valid for v4.19.0+. For prior versions, use defaultSchemaName.


The JDBC driver class


The JDBC driver properties file


Specifies the changeset labels to match. Labels are tags you can add to changesets to control which changeset will be executed in any migration run.


Password to connect to the target database.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.


The path to the script to use to perform the rollback. Only needed if the rollback is not already defined in the changelog, and if it is not a rollback statement that is automatically generated by Liquibase.


Tag version to use for multiple occurrences of a tag. Valid values are NEWEST and OLDEST. If set to NEWEST, Liquibase rolls back changes up to the most recent instance of the tag. Any older instances of the tag remain in the DATABASECHANGELOG table. If set to OLDEST, Liquibase rolls back changes up to the first instance of the tag. Default: OLDEST


Username to connect to the target database.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.


Note: The username and password attributes are not required for connections and systems which use alternate means of authentication. Also, you can specify database credentials as part of the url attribute.

Related links