Rollback updates on error

Hi

I have changelog containing 3 new change sets: A, B, C.
Is it possible to rollback update A and B when update C has failed?
What is the best way to handle situation like this (rollback all previously executed change sets when one change has failed).
I know that I can get current date before executing update command and than use command rollbackToDate but are there any better options to achieve this?

Hi @colinrobinson,

Welcome to our Liquibase forum!

One way to do that would be to group related changesets together with a label:
https://docs.liquibase.com/concepts/advanced/labels.html

Or tag the db before you run the update and roll back to tag afterwards:

Hope that helps,

Ronak

hey colin,

you could also rollback a specific number of changesets with rollbackCount
https://docs.liquibase.com/commands/community/rollbackcount.html

hope that helps!

1 Like

Thanks @mariochampion for responding to @colinrobinson!