runOrder

The runOrder attribute specifies whether a changeset should be run before or after all other changesets instead of running it sequentially based on its order in the changelog. Valid values are first and last. runOrder is not supported in formatted SQL changelogs.

Uses

By default, when you run the update command, Liquibase runs changesets sequentially according to their order in the changelog. Changes at the top of the file are run first, and changes at the bottom are run later.

However, you may have a changeset that you always want to run at the end of a deployment. Instead of moving it to the bottom of the changelog for every database update, set runOrder to last on that changeset. This way, it executes after all other changesets regardless of its order in the changelog.

Syntax

Note: All changelog attributes use the camelCase format.

databaseChangeLog:
  -  changeSet:  
      id:  1
      author:  your.name
      runOrder:  last
      runAlways:  true
      changes:
        -  update:
            tableName:  deployment_log
            columns:
              -  column:
                  name:  latest

{
  "databaseChangeLog": [
    {
      "changeSet": {
        "id": "1",
        "author": "your.name",
        "runOrder": "last",
        "runAlways": "true",
        "changes": [
          {
            "update": {
              "tableName": "deployment_log",
              "columns": [
                {
                  "column": {
                    "name": "latest"
                  }
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
    xmlns:pro="http://www.liquibase.org/xml/ns/pro"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
        http://www.liquibase.org/xml/ns/dbchangelog-ext
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
        http://www.liquibase.org/xml/ns/pro
        http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd">

    <changeSet  id="1"  author="your.name"  runOrder="last"  runAlways="true">
        <update  tableName="deployment_log">
            <column  name="latest"  type="DATETIME"/>
        </update>
    </changeSet>

</databaseChangeLog>

Related links