Hi.
For our project purposes we have decided to go for the object oriented changelog structure.
The idea is to have data/triggers/stored procedures/views/tables etc subfolders in the changelog folder for readability purposes, and then have the main XML changelog file include all of them via includeAll from these folders.
Also, we would name SQL changelogs within those subfolders in accordance with best practices, starting with alphanum sequences so they are run in correct order. Of course, we will go for one command per one changeset file rule.
Since Liquibase runs the files in alphanum order but only within the current folder (right?) we have actually no control over the order of operations in our usual use case, which is a set of changes that has different types of changes (schema/data/triggers/keys/ etc) which are split in corresponding subfolders based on a type of change. In this case the order will correlate firstly with the subfolders, for ex:
<includeAll path="/triggers/" />
<includeAll path="/tables/" />
<includeAll path="/sproc/" />
<includeAll path="/keys/" />
and only then it will run them in their alphanum naming order. In our case that does not suffice as we will usually need to have direct control over the exact ordering of operation, especially with more nuanced and complicated changes like adding triggers, stored procedures, data etc, and in this case the running order would first take the triggers folder into account, followed by tables and stored procedures.
What if we, say, need to create a trigger, then a table, then a sproc and then another trigger, in this exact order? Can we somehow make peace with our includeAll && subfolder split && alphanum ordering intended way of doing things? if so, please advise.
If not, I see some alternatives, which are less preferable for us.
-
Abandon subfolder structure, and keep them all in a single folder referenced via includeAll. Not preferred because very soon there will be hundreds of files.
-
Keep subfolder structure for organization purposes, but have a directly controlled running order in the main xml changelog file, via include of specific files instead of includeAll. Seems like unnecessary extra work.