GitOps with Feature Branch Workflow
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.
- You have two branches:
mainbranch corresponds to the
prodenvrionment, and it has a
devbranch for the feature work corresponds to the
devenvironment, and it has a
- You installed Bytebase and have Workspace Owner role.
Step 1 - Configure the workspace
- Go to Settings > Workspace > Version Control to add a VCS provider.
- Click Environments and create two environments
Prod. You can configure approval policy as require or skip manual approval.
- Click Instances > Add Instance to add instances where
Step 2 - Create
- Click Projects > New Project and enter
Dev Projectin Project Name.
Dev Project, click Transfer in DB and choose
- Click Version Control on the project tab bar, and choose GitOps workflow and enable version control workflow.
Step 3 - Create
- Repeat Step 2, but with Prod instead of Dev, e.g.
Prod Projectinstead of
Step 4 - Create SQL migration file
- Name and organize SQL migration files like this.
The final setup looks like this:
With this setup,
When a SQL migration file is committed to the
devbranch, Bytebase will create an issue in
Dev Projectand apply that migration file to
When you merge the
devbranch to the
mainbranch with one or more SQL migration file commits, Bytebase will create a separate issue for each SQL migration file in
Prod Projectand apply the corresponding migration change to
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.