Change sets, rollbacks and best practices

Hi, I’m a liquibase newbie so have some basic questions.

1.  Is it better that each change set had a single operation like create table or create constraint or should the change set be a logical unit of work?

 

2.  For rolling back - is it better to have everything that i want to rollback in one change set, or I can roll back multiple change sets?  I was only able to roll back a single change set so far.   If changeSet2 fails, is it possible to rollback changeSet1 that has already commited?

 

Thank you for your help!

NK

Sorry for the slow delay.


It is best to have a single operation per changeSet. Many databases auto-commit on create/alter table statements, and if a second change fails the database will be in a strange state for liquibase where the first statement will always fail because it did run but the rest of the changeSet still needs to be executed.


You can roll back multiple changeSets at a time. The built-in chages sometimes have built-in rollback support and sometimes you need to add your own tag to provide rollback support or alter the default.


Nathan