Reputation: 121
As far as I understand, Liquibase execute the changesets according to the order they are written in the change log. I want the changeset to be ran in another order. Is there any way to change the execution order of changesets?
A prompt response for my question would be highly appreciated.
Upvotes: 12
Views: 16326
Reputation: 3856
We had a smiliar approach. We had one xml file per table to have a good overview over every table and its columns. But when we needed to refactor(e.g. add new columns, move some data, add new FKs) our db, it was revealed, that this approach comes with some problems. The possibility to see what belongs to one table and the execution order are in conflict with each other. My best(but still dirty) solution was to start a single new xml file named migration_X.xml with all changeSets to add columns, copy some data, add new constraints or FKs. If I want to see the definition of one table, I generate the DDL.
Upvotes: 2
Reputation: 61
The order of your changelog in Liquibase is the order that changes should be deployed (executed) if needed.
Liquibase relies on you to setup the correct order.
In order to use a dynamic order that matches the current situation you should use a compare & sync tools that will generate the relevant DDL based on your source control repository and your target environment.
Dbmaestro (for which I work) offers this feature
Upvotes: 4