The future-rollback-from-tag-sql command is a helper command that produces the raw SQL Liquibase would need to roll back all undeployed changes made up to the specified tag.


You can use the future-rollback-from-tag-sql command to inspect the raw SQL Liquibase would use to revert changes associated with undeployed changesets. It is similar to the future-rollback-sql command, except that you can use the tag attribute to exclude some undeployed changesets from the SQL output.

It is best practice to inspect the SQL Liquibase runs when using the update command so you can review any changes the command would make to your database.

Note: The update-sql command is a helper command that you can use before running the update command. The main difference is that update-sql creates objects associated with undeployed changesets, and future-rollback-from-tag-sql <tag> drops objects associated with undeployed changesets.

Running the future-rollback-from-tag-sql command

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

Using an XML, YAML, or JSON changelog, create a new changeset containing the tagDatabase Change Type with the tag attribute. Any undeployed changesets before and including the tag will be included in the SQL output, and any undeployed changesets after the tag will be excluded.

Then run the future-rollback-from-tag-sql command:

liquibase --changelog-file=changelog.xml --output-file=future.txt future-rollback-from-tag-sql version_1.3

Note: Enter the name of the changelog and output you want to use in place of changelog.xml and future.txt.

future-rollback-from-tag-sql global attributes

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

Specifies the file path to where the SQL output will be written


*If not specified, future-rollback-from-tag-sql output goes to STDOUT.

future-rollback-from-tag-sql command attributes

Attribute Definition Requirement

The root changelog


The JDBC database connection URL


The database username


The database password


The tag identifying which tagged changesets in the changelog to evaluate.


*Liquibase checks nested changelogs for definitions of the changesets to rollback.

**Database credentials may be specified as independent username and password attributes or as part of the url attribute.

Note: Liquibase does not require the username and password attributes for connections and systems which use alternate means of authentication.