rollbackSQL <tag>
command
The rollbackSQL <tag>
is a helper command that produces the raw SQL Liquibase would run when using the rollback<tag>
command.
Uses
The rollbackSQL <tag>
command is typically used to inspect the SQL Liquibase uses to revert changes associated with a tag you specify when you run the rollback <tag>
command. It is best practice to use the rollbackSQL <tag>
command before running the rollback <tag>
command to ensure that you eliminate any potential risks.
Running the rollbackSQL <tag>
command
To run the rollbackSQL <tag>
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 rollbackSQL <tag>
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 <tag>
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 <tag>
output goes to STDOUT
.

C:\dev\DaticalDB-testing\liquibase-pro-cli-project\postgres_lbpro_master>..\liquibase --changeLogFile=postgres_lbpro_master_changelog.xml rollbackSQL myTag
Liquibase Pro 3.8.10-DAT-4387-SNAPSHOT by Datical licensed to Liquibase Pro Customer until Tue Nov 03 19:00:00 CST 2020
Rolling Back Changeset:postgres_lbpro_master_changelog.xml::4::functionForTrigger::Liquibase Pro User
Rolling Back Changeset:postgres_lbpro_master_changelog.xml::3::createTableforCC-proschema::Liquibase Pro User
Rolling Back Changeset:postgres_lbpro_master_changelog.xml::2::createTableforView-proschema::Liquibase Pro User
Rolling Back Changeset:postgres_lbpro_master_changelog.xml::1::createTableforSynonym-proschema::Liquibase Pro User
Rolling Back Changeset:changelogLevel.xml::2::logicalFilePath::changelog::Liquibase Pro User
Rolling Back Changeset:third_changelog.xml::1::logicalFilePath::changeset:: Liquibase Pro User
-- *********************************************************************
-- Rollback to 'myTag' Script
-- *********************************************************************
-- Change Log: postgres_lbpro_master_changelog.xml
-- Ran at: 5/8/20 10:33 AM
-- Against: daticaluser1@jdbc:postgresql://localhost:5432/goku
-- Liquibase version: 3.8.10-DAT-4387-SNAPSHOT
-- *********************************************************************
-- Lock Database
UPDATE public.databasechangeloglock SET LOCKED = TRUE, LOCKEDBY = 'gemfire-PC (192.168.1.9)', LOCKGRANTED = '2020-05-08 10:33:45.795' WHERE ID = 1 AND LOCKED = FALSE;
-- Rolling Back ChangeSet: postgres_lbpro_master_changelog.xml::4::functionForTrigger::Liquibase Pro User
DROP FUNCTION "proschema".canned_spam CASCADE;
DELETE FROM "public"."databasechangelog" WHERE ID = '4::functionForTrigger' AND AUTHOR = 'Liquibase Pro User' AND FILENAME = 'postgres_lbpro_master_changelog.xml';
-- Rolling Back ChangeSet: postgres_lbpro_master_changelog.xml::3::createTableforCC-proschema::Liquibase Pro User
DROP TABLE "proschema"."suppliers";
DELETE FROM "public"."databasechangelog" WHERE ID = '3::createTableforCC-proschema' AND AUTHOR = 'Liquibase Pro User' AND FILENAME = 'postgres_lbpro_master_changelog.xml';
-- Rolling Back ChangeSet: postgres_lbpro_master_changelog.xml::2::createTableforView-proschema::Liquibase Pro User
DROP TABLE "proschema"."account";
DELETE FROM "public"."databasechangelog" WHERE ID = '2::createTableforView-proschema' AND AUTHOR = 'Liquibase Pro User' AND FILENAME = 'postgres_lbpro_master_changelog.xml';
-- Rolling Back ChangeSet: postgres_lbpro_master_changelog.xml::1::createTableforSynonym-proschema::Liquibase Pro User
DROP TABLE "proschema"."primary_table";
DELETE FROM "public"."databasechangelog" WHERE ID = '1::createTableforSynonym-proschema' AND AUTHOR = 'Liquibase Pro User' AND FILENAME = 'postgres_lbpro_master_changelog.xml';
-- Rolling Back ChangeSet: changelogLevel.xml::2::logicalFilePath::changelog::Erzsebet (generated)
DROP TABLE proschema.lfp_changelog;
DELETE FROM public.databasechangelog WHERE ID = '2::logicalFilePath::changelog' AND AUTHOR = 'Erzsebet (generated)' AND FILENAME = 'changelogLevel.xml';
-- Rolling Back ChangeSet: third_changelog.xml::1::logicalFilePath::changeset::Erzsebet (generated)
DROP TABLE proschema.lfp_changeset;
DELETE FROM public.databasechangelog WHERE ID = '1::logicalFilePath::changeset' AND AUTHOR = 'Erzsebet (generated)' AND FILENAME = 'third_changelog.xml';
-- Release Database Lock
UPDATE public.databasechangeloglock SET LOCKED = FALSE, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;