Liquibase alter sorting

Hi All,

We have a need of using include all keyword in liquibase due to avoiding the conflicts in the liquibase. But ordering is not proper. Any way to resolve the issue.

we required to run the Alter version as:
PR_52_5.2.0.0.8
PR_52_5.2.0.0.9
PR_52_5.2.0.0.10
PR_52_5.2.0.0.11
PR_52_5.2.0.0.20
PR_52_5.2.0.0.21

Now executing:
PR_52_5.2.0.0.10
PR_52_5.2.0.0.11
PR_52_5.2.0.0.20
PR_52_5.2.0.0.21
PR_52_5.2.0.0.8
PR_52_5.2.0.0.9

1 Like

The includeAll keyword reads the changelogs alphabetically. This is likely a function of the underlying operating system and not liquibase itself. You should number your changelogs with leading zeros (eg 5.2.0.0.08) if you want includeAll to sort them properly. Alternatively, you can use include to manually specify the execution order.

1 Like

Use include file within the dependent changelog before the changeset to force liquibase to execute the dependencies first.

Master.changelog.xml
Include all path …

0001.xml
Include file 0002.xml
Changeset 1

0002.xml
Changeset 2