////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////

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 link:GORM.html[GORM] classes. The options are described in the <<dataSource,DataSource>> section:

* `create`
* `create-drop`
* `update`
* `validate`
* no value

In <<environments,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 the Liquibase-based Database Migration plugin.

*  link:{hibernate5Guide}#databaseMigration[Database Migration]

==== Automatic LiquibaseAutoConfiguration Exclusion

When the Database Migration plugin is on the classpath, Grails automatically excludes Spring Boot's `LiquibaseAutoConfiguration` to prevent conflicts. The plugin manages Liquibase through its own lifecycle, and Spring Boot's auto-configuration would create duplicate `SpringLiquibase` beans that cause lock contention and startup failures.

This exclusion is applied at compile time via the `@EnableAutoConfiguration(excludeName=...)` annotation on your `Application` class. You no longer need to manually add `spring.liquibase.enabled: false` to your `application.yml`.

To disable the automatic exclusion, add the following to your project's `gradle.properties`:

[source,properties]
----
systemProp.grails.autoconfigure.exclude.liquibase=false
----
