Capabilities
Bytebase GitOps integration provides two core capabilities:Versioned Database Migrations
- Database-as-code workflow - Manage database changes through your VCS just like application code
- Schema and data changes - Support for both DDL (CREATE/ALTER/DROP tables, indexes) and DML (INSERT/UPDATE/DELETE) operations
- Change detection - Automatically detects and skips already applied migrations, ensuring idempotency
- Progressive deployments - Automated rollout across environments (test → staging → production)
- Multi-database support - Apply changes across multiple databases with batch operations
SQL Review
- Automated validation - Automatically check SQL files against configurable review policies
- Quality and compliance checks - Validate for performance issues, security concerns, and best practices
- PR integration - Review results posted directly as pull request comments
- Merge protection - Block merges when critical issues are detected
- Database-specific rules - Tailored validation for different database engines
GitOps Workflow
1. Development Phase
Developers create SQL migration files in their feature branches:- Schema changes (DDL):
202501150900_add_user_table.sql - Data changes (DML):
202501150901_seed_initial_data_dml.sql
Filenames must conform to the versioning format.
2. Review Phase (Pull Request)
- SQL review runs automatically on the PR
- Validates changes against configured policies
- No release created yet - only validation
3. Release Creation (Merge)
When the PR is merged to main:- GitOps integration automatically creates a new release
- All SQL files from the merge are packaged together
- Release is assigned a unique identifier
- Linked to the merge commit for traceability
4. Progressive Deployment
The release follows your configured deployment pipeline:- Test Environment: Automatic deployment after creation
- Staging Environment: May require manual approval
- Production Environment: Typically requires explicit approval
- Each deployment is tracked with timing and status
Requirements
Filename Requirements
To ensure proper version control and execution, your SQL migration filenames must follow a specific structure. Each filename consists of three main parts: a Version, a Description, and an optional Change Type Suffix.<Version>_<Description>_<Suffix>.sql
Versioning Format
Bytebase supports both semantic versioning and simple timestamp-based versions. The version number is crucial for ordering migrations correctly. The version must begin with a number. Av or V prefix is optional.
Valid Version Examples:
202501150900_add_user_table.sqlv1.2.3_description.sqlV2_add_users_table.sql1.0_initial_schema.sql
Change Type Suffixes
You can add a suffix to the filename to specify the change type. If the suffix is omitted, the file will be treated as the defaultDDL type. The suffix is added to the end of the filename, just before the .sql extension.
-
DDL (Default)
- Used for standard schema changes (Data Definition Language). This is the default type used when no suffix is present.
- Example:
v1.0_create_table.sql
-
DML
- Used for data manipulations (Data Manipulation Language).
- Add the
_dmlsuffix. - Example:
v1.0_insert_data_dml.sql
-
Ghost
- Used for schema changes performed using the
gh-osttool. - Add the
_ghostsuffix. - Example:
v1.0_alter_table_ghost.sql
- Used for schema changes performed using the
GitHub Actions
Tutorial: Database GitOps with GitHub Actions
To reach your self-hosted Bytebase from GitHub Actions, you can choose either options:
- Tunnel GitHub Actions using Cloudflare Zero Trust with Cloudflare Warp GitHub Actions.
- Use self-hosted runners.
Azure DevOps Pipeline
Tutorial: Database GitOps with Azure DevOps Pipeline
GitLab CI
Tutorial: Database GitOps with GitLab CI
If you’re using self-hosted GitLab in an internal network:
-
You’ll need to manually load the
bytebase/bytebase-actionimage into your internal Docker registry. -
Set the
clone_urlin GitLab Runner to avoid redirection to external addresses.

