I think your answer is: โIt does not support dry runs,โ but the problem is mainly with the database and not with liberzase.
Liquibase launches each changeSet in a transaction and commits it after inserting it into the DATABASECHANGELOG table, so theoretically you can redefine Liquibase logic to roll back this transaction instead of committing it, but you will encounter a problem when most of SQL is powered by Liquibase is an automatic commit.
For example, if you have a changeSet from:
<changeSet> <createTable name="test"> ... </createTable> </changeSet>
Performed:
START TRANSACTION CREATE TABLE NAME ... INSERT INTO DATABASECHANGELOG... COMMIT
but even if you changed the last command to ROLLBACK, the create table call will be automatically committed when it starts, and the only thing that will really be a rollback is INSERT.
NOTE. There are several databases that will roll back SQL DDL, such as postgresql, but most do not.
INSERT / UPDATE commands will be executed in a transaction and can be automatically rolled back at the end, but linibase does not have a postCondition command to check the status of a transaction that is required. This would be a useful feature ( https://liquibase.jira.com/browse/CORE-1793 ), but even it will not be used if there are tags in the changeset with automatic committing of changes. If you added a postcondition to create the above example table, the postcondition will fail and the update will fail, but the table will still be there.
source share