Environments settings
Published 20 July 2023
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
Name | Required? | Type | Description |
---|---|---|---|
url | Yes | String | Database JDBC URL |
user | No | String | Database user name |
password | No | String | Database password (usually specified using a resolver) |
token | No | String | Token for connecting to the database (usually specified using a resolver) |
schemas | No | String array | The schemas to track |
No | Table | Additional properties relating to resolvers being used in calculating necessary connection properties | |
displayName | No | String | The name of the database, as it appears in Flyway Desktop UI |
driver | No | String | See here |
connectRetries | No | Integer | See here |
connectRetriesInterval | No | Integer | See here |
initSql | No | String | See here |
jdbcProperties | No | Table | See here |
provisioner | No | String | Determines 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