Making dbm-rollback safe after destructive schema changes in the Grails database-migration plugin
0 reputation · 02 Nov 2022, 11:53 UTC
0 reputation · 02 Nov 2022, 11:53 UTC
Our Grails application uses the database-migration plugin (Liquibase-based) with changelogs under grails-app/migrations, and we are standardizing how schema changes ship to production. The goal is a rollback story that actually works when a release must be reverted, not just one that exists on paper.
The uncertainty is around destructive changeSets. Liquibase can auto-generate rollback for additive changes like createTable or addColumn, but dropColumn, dropTable, and raw sql changeSets either need explicit rollback blocks or cannot restore dropped data at all. We also generate initial drafts with dbm-gorm-diff, and those diffs appear to lack rollback definitions by default. Additionally, some environments still run with dbCreate set to update, which may let Hibernate alter the schema outside Liquibase's tracking and make rollback ordering unreliable.
Assume a recent Grails 5/6 line with the matching database-migration plugin; exact plugin version compatibility still needs confirmation against the documented matrix.
Specific questions:
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.