Skip to main content
After PR/MR merge, Bytebase creates a release, compares the desired state with current database state, generates migration DDL, and deploys.

How SDL Release Works

  1. State Comparison - Bytebase compares your SDL files with current database schema
  2. DDL Generation - Automatically generates ALTER/DROP statements using topological sort
  3. Migration Execution - Applies generated DDL to reach desired state
  4. Revision Tracking - Records new version for future comparisons

CI/CD Integration

Add --declarative flag to enable SDL mode:
Use a compatible bytebase-action image. For Bytebase Cloud, use bytebase/bytebase-action:cloud. For self-hosted Bytebase, replace :cloud with your Bytebase server version, for example :3.14.0.
The examples assume your SDL files live under a schema/ directory - for example schema/tables/users.sql (MySQL) or schema/schemas/public/tables/users.sql (PostgreSQL). If your files live elsewhere, adjust the trigger paths and --file-pattern. The pattern supports ** globs and brace alternation, for example {schemas,tables,views,functions,procedures,triggers,events}/**/*.sql for an export extracted at the repository root.

Version Management

SDL automatically generates versions using timestamp format YYYYMMDD.HHMMSS:
All files in a release share the same version. Bytebase compares this version with the latest revision to determine if deployment is needed.

Migration Generation Example

Current Database:
New SDL:
Generated Migration:

Next Steps

Limitations

Understand SDL constraints and considerations

Best Practices

Production-ready workflow patterns