Tutorial - Create a new database per branch
Published 21 January 2025
- In Flyway Desktop, in the settings cog in the upper right , edit your development database connection details
- Enter a database name which uses the Git resolver to incorporate the branch name into the database name e.g.
TalkrDev_${git.branch:ad}
.
If you have a main
branch and a branch called feature
, you would need to create two databases, TalkrDev_main
and TalkrDev_feature
.
Edit your development environment in your toml config file or user config file, and use the git resolver to generate the database name based on the branch name. For SQL Server this will look something like this:
- [environments.development]
- url = "jdbc:sqlserver://localhost:1433;database=TalkrDev_${git.branch:ad};authentication=sqlPassword;trustServerCertificate=true;"
- user = "sa"
- password = "TalkrPass123"
If you have a main
branch and a branch called feature
, you would need to create two databases, TalkrDev_main
and TalkrDev_feature
.
Next steps
- Combine this approach with Redgate Clone to automatically provision databases on branch switch