Doesn't delete/remove tag changeSet at rollback

Description

we use tag to show which version a database has. But after a rollback tag is remove. But for us the database has the version which was describe by the removed tag. But not able to determine it.

Why is tag removed? Leave tag unchanged at rollback make more sense.

Environment

linux + oracle 11g

Activity

Show:

Adam Gardner November 9, 2018 at 10:25 PM

@nathan.niesen How can this possibly be a duplicate of when this was filed 8 months earlier?

Nathan Niesen September 6, 2018 at 2:31 PM
Edited

This is a duplicate of which has some changelogs to reproduce the issue.

Also, my work-around in was to rollback to the tag and then update to that same tag.

Adam Gardner July 28, 2018 at 12:39 AM

I submitted a pull request to get reverted, but in the meantime I've also found a workaround:

Because of the way was implemented, a tag is only removed on rollback if it's the only change in the changeset (which is the recommended pattern). If the tagDatabase command is in the same changeset as another change, then the tag is not removed during rollback to that tag.

Of course, you don't want to include spurious changes in your changeset that you didn't want, but thankfully liquibase recognizes an 'empty' change that doesn't do anything, and it's enough to 'count' as another change in the same changeset.

Unfortunately, even though the empty change action does literally nothing, liquibase doesn't know how to roll it back automatically (presumably because EmptyChange.java doesn't define a createInverses() method), so any attempt to roll back past your empty change results in failure. To work around this, you can just include an explicit empty rollback tag alongside your empty 'empty' tag. The final result looks like this in YAML:

or like this in XML:

This appears to behave as expected, though of course it means you're technically adding additional 'changes' to the same changeset as your tagDatabase command.

Adam Gardner July 20, 2018 at 10:04 PM

I have to agree, I'd much rather that rolling back to a tag was exactly the same as updating to a tag - that is, after doing so, you have everything up to and inlcuding that tag.

Personally, I believe that was a mistake to implement. That said, if must remain in place, I'd propose implementing a rollbackToTag action that behaves as rollback did previously.

Heather Sullivan August 29, 2017 at 2:26 PM

This also affects SQL Server. Frustrating change.

Details

Reporter

Affects versions

Priority

Created November 19, 2016 at 10:17 AM
Updated November 7, 2024 at 7:47 AM