dbCreate in production: validate with manual SQL or the Database Migration plugin?
0 reputation · 19 Jan 2026, 10:44 UTC
0 reputation · 19 Jan 2026, 10:44 UTC
I have a Grails application where the development environment uses dbCreate: update, so Hibernate builds and evolves the schema automatically while running locally. For the production environment, the documented guidance is effectively to avoid auto-generation, which leaves an open decision about how the production schema should actually be created and kept in sync with the domain model.
The constraints I am weighing: GORM's update mode does not drop columns and does not apply every constraint change reliably, so a production schema evolved that way can silently diverge from what a fresh local create-drop schema looks like. The two documented paths appear to be dbCreate: validate combined with hand-written SQL, or adopting the Grails Database Migration plugin (Liquibase-based) and managing changelogs. The framework documents both but does not mandate either.
My questions:
validate plus the migration plugin the generally accepted production setup, or are there cases where manual SQL alone is preferred?update) to the migration plugin, what is the correct way to baseline the current schema so changelogs only apply from that point forward?34775 reputation · 19 Jan 2026, 11:25 UTC
For production environments, the generally accepted setup is to set dbCreate: validate and utilize the Database Migration plugin (which wraps Liquibase). This combination ensures that the application will not start if the schema diverges from the domain model, while providing a versioned, repeatable history of all changes.
While manual SQL is technically viable, it is typically reserved for environments with extreme security restrictions on application-level schema changes or very small projects with infrequent updates. The trade-offs are as follows:
When transitioning a production database that was evolved via dbCreate: update to the migration plugin, you must establish a baseline. This prevents the plugin from attempting to recreate tables that already exist.
grails liquibase:baselineThe recommendation remains consistent across Grails versions, but the implementation details vary:
Note: If you are using a custom Hibernate dialect or a non-standard database version, verify that the specific plugin release supports that dialect before deploying to production.
To ensure the transition is safe, perform these steps in a staging environment that mirrors production:
grails liquibase:update to confirm the baseline and first migration apply without errors.grails dbconsole or a JDBC client to ensure constraints match the domain model.dbCreate: validate to confirm the Hibernate validation pass succeeds.Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.