4.4.2 Automatic Database Migration 5.3.2

(Quick Reference) # 4.4.2 Automatic Database Migration Version: 5.3.2 ## 4.4.2 Automatic Database Migration The `dbCreate` property of the `DataSource` definition is important as it dictates what Grails should do at runtime with regards to automatically generating the database tables from GORM classes. The options are described in the DataSource section: `create` `create-drop` `update` `validate` no value In development mode `dbCreate` is by default set to "create-drop", but at some point in development (and certainly once you go to production) you’ll need to stop dropping and re-creating the database every time you start up your server. It’s tempting to switch to `update` so you retain existing data and only update the schema when your code changes, but Hibernate’s update support is very conservative. It won’t make any changes that could result in data loss, and doesn’t detect renamed columns or tables, so you’ll be left with the old one and will also have the new one. Grails supports migrations with Liquibase or Flyway via plugins. Database Migration Flyway | Quick Reference (hide)