Rollback-count checksum validation failed

Hi,

I am trying to rollback a change using SQL changeset.

C:\Liquibase\changelogs>liquibase --defaultsFile=“C:\Liquibase\liquibase-4.23.2\liquibase.properties” --changelog-file=“change_master.xml” rollback-count-sql --count=1

[2023-09-27 00:27:34] SEVERE [liquibase.integration] Validation Failed:
1 changesets check sum
changelog_00004_setup_tab4.xml::01_tab4_seq::biraja was: 9:215b343f9072b9c27466113a28fff332 but is now: 9:35f147d415d8938a4ddc08a9463b2287
liquibase.exception.CommandExecutionException: liquibase.exception.ValidationFailedException: Validation Failed:

My changeset looks like this:

<?xml version="1.0" encoding="UTF-8"?>

<changeSet author="biraja" id="01_tab4_seq">
  <sqlFile dbms="oracle"
           endDelimiter=";"
           path="../scripts/tab4_seq.sql"
           relativeToChangelogFile="true"
           splitStatements="true"
           stripComments="false"/>
</changeSet>

My tab4_seq.sql looks like this:

–liquibase formatted sql

–changeset nvoxland:id_41 dbms:oracle endDelimiter=“;” relativeToChangelogFile=“true” splitStatements=“true” stripComments=“false”
create table tab4 (
id int primary key,
name varchar(255)
);
–rollback drop table tab4;

–changeset nvoxland:id_42 dbms:oracle endDelimiter=“;” relativeToChangelogFile=“true” splitStatements=“true” stripComments=“false”
create sequence seq_tab4;

I made a mistake of missing to put “–rollback drop sequence seq_tab4;”

Is there a way I can add it now and try to rollback?

I tried two workarounds:
To set md5sum to null in DATABASECHANGELOG for the changeset entry, did not work. Tried to add validCheckSum9:35f147d415d8938a4ddc08a9463b2287validCheckSum (edited for this post), none of them worked , getting a new error now “liquibase.exception.RollbackFailedException: liquibase.exception.RollbackImpossibleException: No inverse to liquibase.change.core.SQLFileChange created”

Is there a way I can add it now and try to rollback?

Thanks

If you are using “liquibase formatted sql” then you should not use “sqlFile” to execute the file, you should be using “include”. sqlFile implies an UNformatted .sql file. But if you use sqlFile you need to define the rollback inside of the xml changeset, like this:

<changeSet author="biraja" id="01_tab4_seq">
  <sqlFile dbms="oracle"
           endDelimiter=";"
           path="../scripts/tab4_seq.sql"
           relativeToChangelogFile="true"
           splitStatements="true"
           stripComments="false"/>
<rollback>
ROLLBACK SQL HERE, NOT IN .sql WHEN USING sqlFile
</rollback>
</changeSet>

Thank You daryloak.
I am using liquibase formatted sql, so rewrote my xml changeset with"include" and it works.

1 Like