Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

Re : Does Liquibase support dry run?

$
0
0
Your two options in liquibase are running in "update" mode where it actually executes the changesets or "updateSql" mode where it generates the SQL that would run which you can inspect and run as you want.

Liquibase does run each changeSet in a transaction and commits it after inserting into the DATABASECHANGELOG table so in theory you could override liquibase logic to roll back that transaction instead of committing it, but you will run into the problem where most SQL ran by liquibase is auto-committing. 

For example, if you had a changeSet of:

  1. <changeSet>
  2.   <createTable name="test">
  3.    ...
  4.    </createTable>
  5. </changeSet>
What is ran is:
START TRANSACTION
CREATE TABLE NAME ...
INSERT INTO DATABASECHANGELOG...
COMMIT

but even if you changed the last command to ROLLBACK the create table call will auto-commit when it runs and the only thing that will actually roll back is the INSERT.

NOTE: there are databases that will rollback DDL SQL but postgresql is the only one I know of.

Nathan

Viewing all articles
Browse latest Browse all 2993

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>