futureRollbackSQL command

The futureRollbackSQL command is a helper command that produces the raw SQL Liquibase would need to roll back changes that have not yet been deployed to your database.


You can use the futureRollbackSQL command to inspect the raw SQL Liquibase would use to revert changes associated with undeployed changesets.

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

Note: The updateSQL command is a helper command that you can also use before running the update command. The main difference is that updateSQL creates objects associated with undeployed changesets, and futureRollbackSQL drops objects associated with undeployed changesets.

Running the futureRollbackSQL command

To run the futureRollbackSQL command, you need to specify your driver, class path, URL, and user authentication information in your liquibase.properties file. For more information, see Creating and configuring a liquibase.properties file. You can also specify these properties in your command line.

Then run the futureRollbackSQL command:

liquibase --changeLogFile=mychangelog.postgresql.sql --outputFile=future.txt futureRollbackSQL

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

futureRollbackSQL global attributes

Attribute Definition Requirement
--changeLogFile * Specifies the root changelog Required
--url Specifies the JDBC database connection URL Required
--username Specifies the database username Required
--password Specifies the database password Required
--outputFile ** Specifies the file path to where the Rollback SQL will be written Optional

* Liquibase checks the changelog and any nested changelogs for the definitions of the changesets to roll back.

* * If not specified, the futureRollbackSQL output goes to STDOUT.