////
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.
////

=== Configuration

There are a few configuration options for the plugin. All configurations are prefixed with `grails.plugin.databasemigration`:

[options="header"]
|==================================
|Property |Default |Meaning
|changelogLocation |`grails-app/migrations` |the folder containing the main changelog file (which can include one or more other files)
|changelogFileName |`changelog.groovy` |the name of the main changelog file
|changelogProperties |none |a map of properties to use for property substitution in Groovy DSL changelogs
|contexts |none |A comma-delimited list of http://www.liquibase.org/manual/contexts[context] names. If specified, only changesets tagged with one of the context names will be run
|dbDocLocation |`target/dbdoc` |the directory where the output from the <<ref-documentation-scripts-dbm-db-doc,dbm-db-doc>> script is written
|dbDocController.enabled |`true` in dev mode |whether the /dbdoc/ url is accessible at runtime
|dropOnStart |`false` |if `true` then drops all tables before auto-running migrations (if updateOnStart is true)
|updateOnStart |`false` |if `true` then changesets from the specified list of names will be run at startup
|updateOnStartFileName |none |the file name (relative to `changelogLocation`) to run at startup if `updateOnStart` is `true`
|updateOnStartDefaultSchema |none |the default schema to use when running auto-migrate on start
|updateOnStartContexts |none |A comma-delimited list of http://www.liquibase.org/manual/contexts[context] names. If specified, only changesets tagged with one of the context names will be run
|updateAllOnStart |false |if `true` then changesets from the specified list of names will be run at startup for all dataSources. Useful for Grails Multitenancy with Multiple Databases (same db schema)
|autoMigrateScripts |['RunApp'] |the scripts when running auto-migrate. Useful to run auto-migrate during test phase with: ['RunApp', 'TestApp']
|excludeObjects |none |A comma-delimited list of database object names to ignore while performing a dbm-gorm-diff or dbm-generate-gorm-changelog
|includeObjects |none |A comma-delimited list of database object names to look for while performing a dbm-gorm-diff or dbm-generate-gorm-changelog
|databaseChangeLogTableName |'databasechangelog' |the Liquibase changelog record table name
|databaseChangeLogLockTableName |'databasechangeloglock' |the Liquibase lock table name
|==================================

NOTE: All the above configs can be used for multiple datasources


*Multiple DataSource Example:*

If secondary dataSource named "second" is configured in application.yml
[source,yaml]
----
include::{migrationPluginExamplesDir}/src/integration-test/resources/application-multiple-datasource.yml[lines=11..29]
----

The configuration for this data source would be:
[source,groovy]
----
grails.plugin.databasemigration.reports.updateOnStart = true
grails.plugin.databasemigration.reports.changelogFileName = changelog-second.groovy
----
The configuration for all data sources with same db schema would be:
[source,groovy]
----
grails.plugin.databasemigration.updateAllOnStart = true
grails.plugin.databasemigration.changelogFileName = changelog.groovy
----
