I think a slightly different behavior would be a good idea.
The scenario I see is this:
- I execute a changeSet that inserts a row into a table.
- I have specified that the rollback for this changeSet is to do nothing as foreign key constraints etc. get in the way of simply deleting the data that has been inserted.
- When I perform a rollback, liquibase runs no sql (exactly as directed) it then removes the changeSet from the databaseChangeLog table.
- I run the update operation again (after fixing a failure in a different changeSet or other unrelated change). The update fails as I can not insert the same values a second time.
My point here is, I can not see a way in liquibase to actually do ‘nothing’ when rolling back. If I add an empty rollback tag then liquibase still forgets it has run the script even it it does not undo the changes made.
Obviously I can write complex blocks to check values before the statement is run or I can add a similarly complex pre-condition to cover this. But in some cases it would be much nicer if liquibase could actually do nothing when rolling back leaving the appropriate changeLog entries intact.
I understand that this leaves the database in a ‘third’ state that is niether updated or rolled back. I understand that this also means a difference in execution order when rolling forward again. But this is easier to take into account than the alternatives.