How It Works
Instead of writing incremental changes, you maintain the complete schema definition:- Compares your desired state with the current database
- Automatically generates the necessary ALTER/DROP statements
- Executes the generated migration to reach the desired state
When to Use State-Based Workflow
✅ Use state-based workflow when:- You’re managing pure schema changes (DDL only)
- Your team embraces infrastructure-as-code principles
- You want Git-friendly diffs showing schema evolution
- You need simplified management without tracking migration order
- You’re working with PostgreSQL databases (currently supported)
- You prefer automatic dependency resolution over manual ordering
- You need data migrations (INSERT, UPDATE, DELETE)
- You require complex multi-step logic
- You’re working with MySQL, SQL Server, or other databases (not yet supported)
Complete Workflow
The state-based workflow follows the same three stages:Stage 1: Develop
Maintain complete schema definition files representing desired state.Stage 2: SQL Review (PR/MR)
Open a pull/merge request. SDL validation runs in CI/CD.Stage 3: Release (Bytebase)
After merge, Bytebase compares states, generates DDL, and deploys.Next Steps
Develop
Learn about SDL syntax and requirements
SQL Review CI
Set up SDL validation in your CI/CD pipeline
Release
Deploy SDL changes to your databases
Limitations
Understand constraints and considerations

