GitOps with Feature Branch Workflow
Overview
In a Git feature branch workflow, all feature development takes place in a dedicated branch instead of main branch. When the feature development finishes, it will be merged into the main branch. This articles shows you a typical Bytebase setup for teams using one main branch and one dev (feature) branch.
Prerequisites
- You have two branches:
- One mainbranch corresponds to theprodenvrionment, and it has adb_proddatabase.
- One devbranch for the feature work corresponds to thedevenvironment, and it has adb_devdatabase. 
- You installed Bytebase and have Workspace Admin role.
The Procedure
Step 1 - Configure the workspace
- Go to Settings > Workspace > Version Control to add a VCS provider.
- Click Environments and create two environments DevandProd. You can configure approval policy as require or skip manual approval.
- Click Instances > Add Instance to add instances where db_prodanddb_devare located.
Step 2 - Create Dev Project
- Click Projects > New Project and enter Dev Projectin Project Name.
- In Dev Project, click Transfer in DB and choosedb_devdatabase.
- Click Version Control on the project tab bar, and choose GitOps workflow and enable GitOps workflow.
 
Step 3 - Create Prod Project
- Repeat Step 2, but with Prod instead of Dev, e.g. Prod Projectinstead ofDev Project.
Step 4 - Create SQL migration file
- Name and organize SQL migration files like this.
Final Setup
The final setup looks like this:

With this setup,
- 
When a SQL migration file is committed to the devbranch, Bytebase will create an issue inDev Projectand apply that migration file todb_dev.
- 
When you merge the devbranch to themainbranch with one or more SQL migration file commits, Bytebase will create a separate issue for each SQL migration file inProd Projectand apply the corresponding migration change todb_prod.
info
Bytebase only creates the issue with the migration change. Depending on the environment approval policy, Bytebase will either apply the change immediately to the database or wait for approval.
