We have a pretty big set of existing database changes.
Our initial schema creation script is over 1000 changeSet’s, and then we have 8 other “version” increments each stored in their own xml file, and consisting of between 30 and 100 changes each.
We managed this changeset during the development of our product, but recently have found that we need to make some major surgery. To make this work we have created a new schema file that all NEW database created should run from.
But we do have a set of existing databases that we want to upgrade to match this structure.
I have all of the different upgrade statements, but I need to have liquibase selectivly run entire xml files based on the state of the system it is running against.
If I simplify this for an example lets say I have
master.xml
- file1.xml (initial schema)
- file2.xml
- file3.xml
- file4.xml
- lastupgrade.xml
- newschema.xml (the entire new schema)
- anotherchange.xml
The scenarios I need to support are:
* Any new database (ie has had NO changesets run against it) should run newschema.xml, then anotherchange.xml
* A database that has run up to file2.xml should run, file3, file4, lastupgrade, then skip new schemea but run anotherchange.
Basically I created a new schema and put it in the ‘newschema.xml’ file, and created an upgrade from the old structure to new and put it in the ‘lastupgrade.xml’ file.
Hopefully this makes sense. So now to what I’ve tried.
I’ve tried to add a preCondition to the top of file1 --> file4 saying don’t run this is file1-change1 has not been run.
But that doesn’t seem to work.
Is there anyother way do do this? I don’t want to add a precondition to each changeSet as I have lots and lots of changeSets that I don’t want to bloat.