Before deployment, I ran ‘liquibase tag’ command. When I finished with deployment and want to rollback the change with the tag, I encounter error: “Caused by: liquibase.exception.RollbackFailedException: liquibase.exception.RollbackImpossibleException: No inverse to liquibase.change.core.RawSQLChange created”
The “No inverse to…” error indicates that either:
- You have not provided the rollback sql for a changeset that contains custom sql.
- Auto-rollback is not available for the change-type you are using in xml/yaml/json.
Therefore, Liquibase does not know how to rollback your changeset.
Can you provide an example of your changeset?
The changeset is sql file generated using Postgresql pg_dump utilities for the whole database schema which has close to 500 tables plus indexes etc. For example:
– liquibase formatted sql
– changeset lbadmin:GL-915 postgresql
CREATE TABLE pul.prop_cmv (
id bigint NOT NULL,
property_status character(1) NOT NULL,
region character(2) NOT NULL,
map_code character(3) NOT NULL,
division_code character(3) NOT NULL,
property_code character(3) NOT NULL,
county_mun character(4) NOT NULL,
parcel_code character(5) NOT NULL
ALTER TABLE pul.prop_cmv OWNER TO pul_tst;
CREATE TABLE pul.admin (
id integer NOT NULL,
on_lock boolean DEFAULT false,
I guess without manually added the ‘–rollback’ script, even with tag, there is no way to rollback the deployment. I have to say backup the database using means outside of Liquibase if I want to be able to rollback the changes.
Correct, when using formatted sql you cannot use Liquibase rollback unless each changeset has the required sql commands for rollback defined. For your example:
–rollback drop table pul.prop_cmv;
–rollback drop table pul.admin;
If you want to use an external backup to “rollback” your changes then there is no reason to use the Liquibase rollback command.