liquibase: Rollback is broken
Description Rollback does not work, with tags or with count, doesn’t respect rollback sql file.
To Reproduce
<changeSet id="5" author="ale">
<tagDatabase tag="before_provisioning_1"/>
</changeSet>
<changeSet id="6" author="ale">
<sqlFile path="add_two_columns_to_table_a_create_two_new_tables_add_foreign_key.sql" relativeToChangelogFile="true"/>
<!-- this rollback is for reference only, liquibase rollback is broken , doesn't jump to previous changeset,
doesn't undo changes -->
<rollback>
<sqlFile path="some_rollback_script_which_works_against_db.sql" relativeToChangelogFile="true"/>
</rollback>
</changeSet>
liquibase rollbackSQL before_provisioning_1 --changeLogFile liquibase.xml --url="jdbc:mysql://localhost:3306/credentials" --classpath="/home/ale/liquibase/src/java/mysql-connector-java-5.1.47.jar" --password=some --username=root
Liquibase Community 3.8.7 by Datical
-- *********************************************************************
-- Rollback to 'before_provisioning_1' Script
-- *********************************************************************
-- Change Log: liquibase.xml
-- Ran at: 11/03/20 16:23
-- Against: root@172.17.0.1@jdbc:mysql://localhost:3306/credentials
-- Liquibase version: 3.8.7
-- *********************************************************************
-- Lock Database
UPDATE credentials.DATABASECHANGELOGLOCK SET `LOCKED` = 1, LOCKEDBY = '172.17.0.1 (172.17.0.1)', LOCKGRANTED = '2020-03-11 16:23:18.432' WHERE ID = 1 AND `LOCKED` = 0;
-- Release Database Lock
UPDATE credentials.DATABASECHANGELOGLOCK SET `LOCKED` = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;
As you can see the above is empty, it refuses to execute contents of mysql file.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (5 by maintainers)
What I typically do when running from the command line is I create a file named
liquibase.properties
in the directory where I will be running the command, and in that file I put things like the changeLogFile, url, etc. This makes running commands much easier. This is described in more detail in the documentation at https://www.liquibase.org/documentation/config_properties.htmlIf you don’t use a properties file, the correct format for the command line would be to have the parameters first, then the command. You have
liquibase <command> <global parameters>
but the command line expectsliquibase <global parameters> <command>
.