Is it possible to order the sequence patches are run based on there filenames?

I am working on a relatively large project which is broken up as follows:
core - base used by all projects
project1
project2
project3
etc…

All the projects are separate implementations of the program but all use the core. when liquibase runs the patches on db’s it firstly runs those for the core followed by those for the specified project.

When creating patches for the databases (mysql dbs) we have a naming convention of putting the date and time at the beginning of the patch filename (e.g. 2011_01_25-13_00_34-filename.xml). These patches may only be released at a later date but by then another patch may have been released for the core which modifies table structures and thus causes the initial patch to fail.

Is this possible? So the files are organised once they have been pulled from their respective directories and then they are executed.

I need liquibase to execute the patches by the date and time specified in the filename. So pull the first “2011_01_25-13_00_34”, strip “-” and “_” then organise and apply patches by ordered the number sequence:  “20110125130034” followed by the next patch say “20110127120000” etc.

Would generating a changelog which includes the patches in the correct order?

Switching to using (possibly generated) rather than would be easiest.


Another option would be to configure liquibase to run with a different ResourceAccessor than the default FileSystemResourceAccessor which you can code to sort the files however you want.


How you change the resourceAccessors would depend on how you are running liquibase.


Nathan