Environments Namespace
Published 15 January 2025
Environments are a set of associated properties used to connect to a database.
The concept of an environment has been created to allow Flyway to work easily with several different databases or configurations from a single configuration file.
Environment settings
| Setting | 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). |
schemas |
No | String array | The schemas to track. |
displayName |
No | String | The name of the database, as it appears in Flyway Desktop UI. |
driver |
No | String | The jdbc driver to use to connect to the database. |
connectRetries |
No | Integer | The maximum number of retries when attempting to connect to the database. |
connectRetriesInterval |
No | Integer | The maximum time between retries when attempting to connect to the database. |
initSql |
No | String | SQL statements to be run immediately after a database connection has been established. |
provisioner |
Determines the type of provisioning to use for this database. |
Environment namespaces
| Namespace | Description |
|---|---|
flyway |
Flyway namespace properties to override for the environment. |
jdbcProperties |
JDBC properties to pass to the JDBC driver when establishing a connection. |
resolvers |
Additional properties relating to resolvers being used in calculating necessary connection properties. |
TOML Configuration
These parameters should be configured in an environments namespace.
[environments.example]
url = "jdbc:sqlite:local_database1.db"
username = "bob"
...
[environments.another_example]
url = "jdbc:sqlite:local_database2.db"
username = "jeff"
...
[environments.another_example]
locations = ["defaultLocation","customLocation"]
Resolvers
Usually you won't want to keep sensitive information in a plain text configuration file and so resolvers can be used to pull information into your configuration from a variety of external sources like environment variables and secrets managers.
Command line configuration
It is possible to define an environment on the commandline, for example:
./flyway info -environments.example.url=jdbc:sqlite:local_database.db -environment=example
Note: You define an environment using the
environments (plural) namespace but you specify which environment to use with the
environment (singular) parameter. It's a bit of a trip hazard but it has some logical purpose to it.
Legacy configuration
Properties that were originally part of the regular flyway configuration (-url, -user,
-password) can still be used for backwards compatibility. Under the hood, Flyway will map these onto an environment named
default for you and then use them like any other environment.
This documentation contains proprietary information and is protected by copyright law.
Copyright © 2026 Red Gate Software Limited. All rights reserved