Capturing development database schema in version control
Published 11 October 2021
In order to capture changes to your database in your version control system, you need to configure a development environment, save changes you make to that environment to your schema model on disk, and then commit and push those changes to share them with your team.
Configuring a development environment
Before beginning to capture information in your schema model, you will need to configure the development environment you will use for making your database schema changes.
If you already have a development environment, follow this tutorial to configure the connection.. For guidance on more complex database connections, see Connecting to environments.
If you have not yet set up a development database, you will want to provision a database whose schema matches the baseline state of your production database. You can do this via your own means, or using Redgate Clone or Redgate Test Data Manager to provision one. A common use case is to generate a development database based upon a sanitized clone or backup of production. You can also potentially populate a development database using Flyway only: if you are using migrations, you can populate an empty development database by creating a baseline script, and then running migrate on the empty development to deploy that script.
Choosing where to save environment configuration
If you have a dedicated development database, you will likely want to store that database connection information in your user settings. This allows you to configure your database without sharing that connection information through Version Control.
If everyone on your team is using the same development database, then it is preferable to save the database information to the project settings so that the connection information does not need to be reentered by everyone on the team.
It is also possible to spread the configuration between the two files. It might be that the URL is the same but your credentials differ.
Choosing a branch strategy
You might want to make your changes on a branch,.
Relevant tutorials
- Tutorial - Commit changes to version control
- Tutorial - Configure the development database
- Tutorial - Save development database changes to the schema model