Environments settings

An environment in the toml settings file represents a database used in part of your development or deployment workflow.

Each environment contains identifying information and the necessary connection details for the database.

Elements

NameRequired?TypeDescription
urlYesStringDatabase JDBC URL
userNoStringDatabase user name
passwordNoStringDatabase password (usually specified using a resolver)
tokenNoStringToken for connecting to the database (usually specified using a resolver)
schemasNoString arrayThe schemas to track

resolvers

NoTableAdditional properties relating to resolvers being used in calculating necessary connection properties
displayNameNoStringThe name of the database, as it appears in Flyway Desktop UI
driverNoStringSee here
connectRetriesNoIntegerSee here
connectRetriesIntervalNoIntegerSee here
initSqlNoStringSee here
jdbcPropertiesNoTableSee here
provisionerNoStringDetermines the type of provisioning to use for this database. Forthcoming.

Resolvers

If a property contains a value of the form ${resolver-name} or ${resolver-name.resolver-key} then that property will be calculated before connecting to a database.
As part of this, additional properties may need to be specified under the resolvers sub-table - which themselves may be resolvable.

Here are some examples:

[environments.development]
url = "jdbc:sqlserver://server;instanceName=instance;databaseName=development"
user = "Username"
password = "${localSecret.key}"
[environments.production]
url = "jdbc:sqlserver://server;instanceName=instance;databaseName=production;authentication=activedirectoryinteractive"
token = "${azureAdInteractive}",
resolvers = { azureAdInteractive: properties },

[environments.production.resolvers.azureAdInteractive]
tenantId = "tenant-id"
clientId = "client-id"

Example

[environments.development]
url = "jdbc:oracle:thin:@//localhost:1521/dev"
user = "developmentUsername"
password = "developmentPassword"
schemas: ["FW-PROJECT"]
displayName = "Development database"

[environments.shadow]
url = "jdbc:oracle:thin:@//localhost:1521/shadow"
user = "shadowUsername"
password = "shadowPassword"
schemas: ["FW-PROJECT_SHADOW"]
displayName = "Shadow database"
provisioner = "clean"

Usage

You can reference these environments from the Flyway CLI:

flyway info -environment=development

If you specify an environment and a -url, or any CLI parameter that overrides a parameter inside an environment, the CLI parameters will take precedence. In the follow example, dev2 gets used as the database instead of dev :

flyway info -url="jdbc:oracle:thin:@//localhost:1521/dev2" -environment=development

Didn't find what you were looking for?