Reputation: 2332
Is the CHANGESET execution in liqibase dependent on its position in the xml? For example if I have a the liquibase script as below
<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>
My understanding is the changeset
ordering is:
If I now add another changeset in between 1 and 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>
will the new changeset execution order be
Upvotes: 6
Views: 12217
Reputation: 19060
Only to be more clear, Liquibase executes the changesets by the order in the file.
As explained here, the ID content does not make any effect in the execution order:
The id tag is only used as an identifier, it does not direct the order that changes are run and does not even have to be an integer.
Upvotes: 4
Reputation: 9392
Yes, Liquibase reads the changeSets in order. See the Changeset Documentation
Upvotes: 9