Question/suggestion about “database tagging” feature in Liquibase.
Currently, when you tag the database, the tag will be associated with the latest changeset and tagging it again with a different tag will overwrite the previous one. In our use case it would be useful if we could tag the same database state with multiple different tags.
Why? Imagine that each time you update your software (e.g. from 1.0 to 1.1), you perform the following steps:
- tag database with tag "pre-1.1"
- apply database changes
- apply application code changes
- if update failed, roll back to tag "pre-1.1"
This workflow will work, if there are database changes in each new version or if you never want to roll back more than one version. However, it will fail if there are updates with no database changes and you would like to roll back more than just one version.
Example: Upgrade from 1.0 to 1.1 and to 1.2.
1.0 had one changeset, let’s call it CS.
1.1 contains no new changesets.
1.2 contains no new changesets.
When update to 1.1 starts, CS is tagged with “pre-1.1”.
When update to 1.2 starts, CS is tagged with “pre-1.2” (replaces “pre-1.1”).
Now, if user wants to roll back to version 1.1, he is able to roll database to tag “pre-1.2”.
However, if he would like to roll back to version 1.0, he no longer has the tag “pre-1.1” to roll back to.
Solution? Do not overwrite existing tags, keep old tags in addition to new ones. Could be achieved by a separate “tags” table or some hack of storing more than one tag name in same column.
If you can provide some pointers, I would be happy to help in getting this implemented.
Neeme