Liquibase rollback acts like it works. But does nothing

Liquibase rollback acts like it works. But does nothing
My master changelog is in XML. The changelog files are in SQL.

Here is my output after running my rollback command to check the SQL
I anonymized the output here for security reasons

These commands on the bottom of my file are NOT run during a rollback.
– rollback DROP TABLE IF EXISTS XXXX."FILE_XXXX_RELATIONSHIPS"​;

– rollback DROP TABLE IF EXISTS XXXX.“FILE_METADATA”;

– rollback DROP SCHEMA IF EXISTS XXXX;
Here is the output to check the SQL:

liquibase rollbackToDateSQL 2021-11-00
– *********************************************************************
schema-manager2_1 | – Rollback to 2021-10-31 Script
schema-manager2_1 | – *********************************************************************
schema-manager2_1 | – Change Log: ./changelog/XXXX/changelog_dir1/000020_XX-2058_schema_and_table_creation.sql
schema-manager2_1 | – Ran at: 11/4/21, 4:27 PM
schema-manager2_1 | – Against: XXXX_local@jdbc:postgresql://database:5432/XXXX_local
schema-manager2_1 | – Liquibase version: 4.5.0
schema-manager2_1 | – *********************************************************************
schema-manager2_1 |
schema-manager2_1 | – Lock Database
schema-manager2_1 | UPDATE public.databasechangeloglock SET LOCKED = TRUE, LOCKEDBY = ‘82XXXXXX (192.XXX.XX.X)’, LOCKGRANTED = ‘2021-11-04 16:27:04.719’ WHERE ID = 1 AND LOCKED = FALSE;
schema-manager2_1 |
schema-manager2_1 | – Release Database Lock
schema-manager2_1 | UPDATE public.databasechangeloglock SET LOCKED = FALSE, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;
schema-manager2_1 |
schema-manager2_1 | – Lock Database
schema-manager2_1 | UPDATE public.databasechangeloglock SET LOCKED = TRUE, LOCKEDBY = ‘82XXXXXX (XXX.XXX.XX.4)’, LOCKGRANTED = ‘2021-11-04 16:27:05.012’ WHERE ID = 1 AND LOCKED = FALSE;
schema-manager2_1 |
schema-manager2_1 | – Release Database Lock
schema-manager2_1 | UPDATE public.databasechangeloglock SET LOCKED = FALSE, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;
schema-manager2_1 |
schema-manager2_1 | Liquibase command ‘rollbackToDateSql’ was executed successfully.
schema-manager2_1 | Done

Hi @steve_bolotin ,

Can you provide an example of how your masterchangelog is configured? The reason I ask is that there are a couple of different ways to invoke SQL from XML, e.g., using <include> tag or using <sqlFile> change type.

And the way to invoke rollback in each of these two cases is different.

The <include> tag approach expects you to embed rollback as --rollback inside your SQL script, given that you are using Liquibase formatted SQL.

However, when using <sqlFile>\ change type, you will need to add rollback as separate script. Here’s an example:

<changeSet author="amalik" id="3">
     <sqlFile path="sql/t1.sql"
        relativeToChangelogFile="true"
        encoding="UTF-8"/>
    <rollback>
        <sqlFile path="sql/t1-rollback.sql"
            relativeToChangelogFile="true"
            encoding="UTF-8"/>
    </rollback>
</changeSet>

My master changelog points to a directory with includeALL

calling liquibase with the rollback command says it works but rolls back nothing.

Tried rolling back to a database tag that I created:
liquibase rollback version_1.0 --logLevel=info --changeLogFile=./changelog/mystuff/changelog_mystuff.xml --url=jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_NAME} --username=${DB_USER} --password=${DB_PASSWORD}

How many changesets were applied after the tag “version_1.0”?

Hi @steve_bolotin, were you able to solve your issue? I’m having the same issue and still cannot figure it out :frowning: