Redgate Flyway

Tutorial - Update development environment automatically on branch switch using Redgate Clone


  1. In Flyway Desktop, in the settings cog in the upper right , edit your development database connection details
  2. Select Redgate Clone from the provisioning method dropdown
  3. Fill out the relevant Clone URL, image, and authentication token for your instance of Redgate Clone
  4. Enter a data container value which is dynamic based upon the git branch name, e.g. TalkrDev_${git.branch:ad}
  5. When you test and save connection, the database for the current branch will be provisioned as part of the connection test if it does not exist already. 

If you switch from a main branch to a branch called feature, your database will change from TalkrDev_main to TalkrDev_feature. The database will be provisioned when you first try and connect to it.

Edit your development environment in your toml config file or user config file, and use a combination of the git resolver and Redgate Clone provisioner to generate the database name based on the branch name. For SQL Server this will look something like this:

  1. [environments.development]
  2. url = "${clone.url}databaseName=TalkrDev;"
  3. provisioner = "clone"
  4.  
  5. [environments.development.resolvers.clone]
  6. dataImage = "fwd-examples-talkr-mssql"
  7. dataContainer = "TalkrDev_${git.branch:ad}"
  8. dataContainerLifetime = "1h"
  9. url = "https://clone.red-gate.com:8132/cloning-api/"
  10. authenticationToken = "my-token"

If you switch from a main branch to a branch called feature, your database will change from TalkrDev_main to TalkrDev_feature. The database will be provisioned when you first try and connect to it.

Note that in this example you will need to configure the Clone parameters to correctly match your Redgate Clone installation.



Didn't find what you were looking for?