(Quick Reference)

3 Configuration

Version: 6.3.0-SNAPSHOT

3 Configuration

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

Property Default Meaning

changelogLocation

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 context names. If specified, only changesets tagged with one of the context names will be run

dbDocLocation

build/dbdoc

the directory where the output from the 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 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 Grace 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

All the above configs can be used for multiple datasources

Multiple DataSource Example:

If secondary dataSource named "second" is configured in application.yml

dataSource:
    pooled: true
    jmxExport: true
    driverClassName: org.h2.Driver
    username: sa
    password:
    dbCreate: none
    url: jdbc:h2:file:./multipleFirstDb
    logSql: true
    formatSql: true
dataSources:
    second:
        pooled: true
        jmxExport: true
        driverClassName: org.h2.Driver
        username: sa
        password:
        dbCreate: none
        url: jdbc:h2:file:./multipleSecondDb

The configuration for this data source would be:

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:

grails.plugin.databasemigration.updateAllOnStart = true
grails.plugin.databasemigration.changelogFileName = changelog.groovy