VCS Integration (GitOps)
"Version controlled schema" aka "Database-as-code" is a practice to store the database schema in a version control system (VCS) just like how application code is stored. The database schema consists of a bunch of database migration scripts. These scripts usually follow a naming convention to identify the order of their relative execution sequence. After executing all the migration scripts, it will produce an exact copy of the database schema to the corresponding live database. In this model, the migration scripts are the source of truth of the database schema. You can check the reference for a detailed writeup on this topic.
The VCS Integration is a 3-step setup. You can check this demo issue created by Bytebase through observing the code commit to see what it looks like after the setup.
Step 1 - Add Git Provider
This can only be performed by the "Workspace Owner" with the help of the selected Git provider instance admin. It only needs to be configured once for each Git provider.
Step 2 - Enable GitOps Workflow in Project
Configure project to use "GitOps workflow" and link the project with a repository from the Git provider configured in Step 1. This can only be performed by the "Project Owner".
Step 3 - Name and Organize Schema Files
Organize the repository schema files according to the configured base directory and file path template in step 2. Afterwards, the file changes can be observed and identified by Bytebase to apply the schema changes to the corresponding database.