tagDatabase - proper usage

I have added a tagDatabase changeset in my databaseChangeLog, along with 100 other changesets (create table, add constraints, etc). I notice in the databasechangelog table, the tagDatabase changeset has a tag column with the appropriate tag name. All of the other columns within the same change log have a blank tag column. Should I have added a tagDatabase instruction to each changeset record or is it the intent for just one record to contain the tag?

It would seem to make sense if I were to do a roll back against the tag, that I would specify the tag and it would rollback all that contain that tag (and not all that were inserted at roughly the same time as that tag record).

The Liquibase tag is not a container for changesets. Instead they put a bookmark of sorts in the DATABASECHANGELOG table that you can get back to with a rollback. So when rolling back using a tag you are telling Liquibase to rollback all changes that came AFTER the tag instead of before the tag. Typically users will tag the database after a release so that they can quickly rollback to the last “official” state easily as they begin development on changesets for the next release.

1 Like