Can Grails database-migration rollback safely reverse schema changes across multiple datasources when DDL is non-transactional?
0 reputation · 22 Oct 2021, 05:59 UTC
0 reputation · 22 Oct 2021, 05:59 UTC
In a Grails application that uses the database-migration plugin, schema evolution is tracked through ordered Liquibase changesets. The plugin supports explicit rollback blocks, but rollback safety depends on whether the underlying database treats DDL as transactional. Many storage engines auto-commit DDL, so a failed rollback can leave the schema in an intermediate state.
GORM runtime transactions such as withNewTransaction or TransactionService wrap DML only. Schema modifications made by Hibernate's hbm2ddl.auto at startup occur outside these transaction boundaries. Grails also permits both automatic schema updates and migration-based rollback without enforcing a single source of truth.
In multi-datasource configurations, migrations and rollbacks must be coordinated across every datasource to avoid partial states. The unresolved issue is identifying the reliable rollback boundary when these mechanisms intersect.
hbm2ddl.auto has already modified a schema outside the changelog before a rollback is attempted?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.