rollbackSQL

The rollbackSQL is a helper command that produces the raw SQL Liquibase would run when using the rollback command.

Uses

The rollbackSQL command is typically used to inspect the SQL Liquibase uses to revert changes associated with a tag you specify when you run the rollback command. It is best practice to use the rollbackSQL command before running the rollback command to ensure that you eliminate any potential risks.

Running the rollbackSQL command

To run the rollbackSQL command, you can specify the driver, classpath, and URL 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 rollbackSQL command:

liquibase --changeLogFile=postgres_lbpro_master_changelog.xml rollbackSQL myTag

Note: Enter the name of the changelog and tag that you want to use in place of postgres_lbpro_master_changelog.xml and myTag.

rollbackSQL global attributes

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

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

**If not specified, rollbackSQL output goes to STDOUT.

Note: The username and password attributes are not required for connections and systems which use alternate means of authentication.

rollbackSQL command attributes

Attribute Definition Requirement
<tag> The tag you can add to changesets to determine which changesets in the changelog to evaluate based on their tags. Required