liquibasechangeset顺序在后续更新中是否会更改?

The*_*ode 2 mysql liquibase

liqibase中的CHANGESET执行是否取决于它在xml中的位置?例如,如果我有一个liquibase脚本,如下所示

<changeSet id="20140211_001" author="test">
    <createTable tableName="alarm_notification_archive">
        <column name="id" type="bigint">
            <constraints nullable="false" />
        </column>

        <column name="event_timestamp" type="timestamp" defaultValue="0000-00-00 00:00:00">
            <constraints nullable="false" />
        </column>
    </createTable>
</changeSet>

<changeSet id="20140210_001" author="test">
    <sql>ALTER TABLE `notification_archive` ADD COLUMN
        `is_Alarm_Outstanding` BOOLEAN DEFAULT FALSE</sql>
    <rollback>
        <sql>ALTER TABLE notification_archive DROP COLUMN
            is_Alarm_Outstanding
                </sql>
    </rollback>
</changeSet>
Run Code Online (Sandbox Code Playgroud)

我的理解是changeset排序是:

  1. 20140211_001
  2. 20140210_001

如果我现在在1和2之间添加另一个变更集

<changeSet id="20140211_001" author="test">
    <createTable tableName="alarm_notification_archive">
        <column name="id" type="bigint">
            <constraints nullable="false" />
        </column>

        <column name="event_timestamp" type="timestamp" defaultValue="0000-00-00 00:00:00">
            <constraints nullable="false" />
        </column>
    </createTable>
</changeSet>

<changeSet id="20140212_001" author="test">
    <sql>ALTER TABLE `notification_archive` ADD COLUMN
        `is_Alarm_Outstanding` BOOLEAN DEFAULT FALSE</sql>
    <rollback>
        <sql>ALTER TABLE alarm_notification_archive DROP COLUMN
            is_Alarm_Outstanding
            </sql>
    </rollback>
</changeSet>

<changeSet id="20140210_001" author="test">
    <sql>ALTER TABLE `notification_archive` ADD COLUMN
        `is_Alarm_Outstanding` BOOLEAN DEFAULT FALSE</sql>
    <rollback>
        <sql>ALTER TABLE alarm_notification_archive DROP COLUMN
            is_Alarm_Outstanding
            </sql>
    </rollback>
</changeSet>
Run Code Online (Sandbox Code Playgroud)

新的变更集执行顺序将是

  1. 20140211_001
  2. 20140212_001
  3. 20140210_001

Moh*_*eem 5

是的,Liquibase按顺序读取changeSets。请参阅变更集文档