GitOps with VCS Integration
"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. In this model, the migration scripts are the source of truth of the database schema.
You can check this demo issue to see what it looks like after the setup. This issue is created by Bytebase after observing the code commit.
-
Developer commits the change in VCS
-
The commit triggers a corresponding issue
-
If SQL Review CI is configured, The PR page will show the inline check
The VCS Integration is a 3-step setup.
Step 1 - Add Git Provider
This can only be performed by the "Workspace Admin" 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.