Reputation: 2463
Is it possible to generate change logs, merging change sets together?
Like this:
<changeSet author="Author" id="1">
<dropNotNullConstraint columnDataType="varchar(255)" columnName="name" tableName="table"/>
<dropNotNullConstraint columnDataType="varchar(255)" columnName="phone" tableName="table"/>
<dropNotNullConstraint columnDataType="bigint" columnName="email" tableName="table"/>
</changeSet>
instead of this:
<changeSet author="Author" id="1">
<dropNotNullConstraint columnDataType="varchar(255)" columnName="name" tableName="table"/>
</changeSet>
<changeSet author="Author" id="2">
<dropNotNullConstraint columnDataType="varchar(255)" columnName="phone" tableName="table"/>
</changeSet>
<changeSet author="Author" id="3">
<dropNotNullConstraint columnDataType="bigint" columnName="email" tableName="table"/>
</changeSet>
If so, can you choose a custom scope? (e.g. all changes in a given table are grouped together, etc.). If not, is there a 'best practice' reason for avoiding grouping them manually?
Upvotes: 0
Views: 125
Reputation: 4922
If you mean command generateChangeLog then no, there is no option to put all changes in one changeLog
. However you can create that programatically if you need.
Liquibase should changes per changeSet
because each changeSet
is executed in one transaction read here. So if you include a lot of changes inside one changeSet
and execution of that changeSet
fails, it would be harder for you to find on which change it failed. It's better to handle change per changeSet
.
note: sometimes I'm also using multiple changes per changeSet
(for example remarks (comments) for table or DML (data) modifications) but I prefer to have one DDL per changeSet.
Upvotes: 1