Script running order doesn't follow name sorting

Hello!

I’m using liquibase formatted sql, in master.xml i call a directory with include all. The running order of script doesnt follow alphabetical order. I have attached en example, in the attached example 10_sql.sql runs before 1_sql.sql.

Thanks in advance!

Regards

Raste

10 does come before 1 when sorted in “ASCII-betical” order. It would be better to name your files like this:

0001-firstfile.sql

0002-secondfile.sql

etc.

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

Thanks for fast responce!

well i solved the problem in that way my self, that would definetly work. But technically when you come up to fifth digit then all files renamed with a leading zero which is not so effective when it comes to Git version controled script.

is there anyway to choose another sorting mechanism in coming liquibase versions?

Regards

Raste

As far as I know, there is no other way to set the sorting order. If you are concerned about eventually having more than 9,999 change files, start with a 5 digit number so you won’t have to deal with it until 99,999. Should be enough for any project I have ever run across. 

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/