Flyway

Getting started with the Flyway Service

The Flyway Service can only work with flyway projects which are using a TOML configuration file. If you already have a TOML file, proceed to the steps below, if not please click here to learn how to get one.
You can learn more about TOML here

1.Enable Flyway Service

In your CI pipeline, configure Flyway CLI to publish to the Flyway Service.

id = "<your Project ID guid here>" # Project id guid
name = "my project" # Project name (optional)

[ flyway ]
publishResult = true # Enables publishing
email = "joe.bloggs@example.com" # Email address associated with PAT token

No token or password is set yet. We will do so in the following steps.

2. Setup Flyway environments

Configure an environment to use in your Flyway TOML configuration file.

Flyway Service groups deployments using the environment configuration option. Ensure you have configured an environment to match the database you're deploying to:

[environments.your_environment]
url = "<your database connection JDBC URL>"
user = "<your user>"
password = "<your password>"

Even if you don't have environment specific config defined in your TOML configuration file you will still need an environment block. In this case you should leave the block empty.

3. Create a PAT token

Go to the link provided below and copy the resulting token.

https://identityprovider.red-gate.com/personaltokens

4. Configure the CI pipeline

Once you have your personal access token and environment, we recommend you configure Flyway to use the token and environment in one of two ways:

Command Line
flyway migrate -token="<your personal access token here>" -environment="<your environment here>"

Environment Variable
FLYWAY_TOKEN=<your personal access token here> FLYWAY_ENVIRONMENT=<your environment here>

You should treat the token as a secret, we don't recommend committing this to source control. The email configuration option can also be configured on the command line, in an environment variable, or in the TOML.

5. Migrate your database

The next time your pipeline runs flyway migrate, it will publish the result to Flyway Service.


Didn't find what you were looking for?