Repository Structure
Monorepo Approach
Database migrations alongside application code:- Migrations versioned with application code
- Atomic commits for schema + code changes
- Single source of truth
- Small to medium teams
- Tight schema-code coupling
- Monolithic or modular monolith architectures
Separate Repository
Dedicated database repository:- Separation of concerns
- Independent deployment cycles
- Multiple teams/databases
- Larger organizations
- Dedicated database teams
- Microservices with shared databases
Directory Layout
For Migration-Based Workflow
Option 1: Organized by Category- Clear organization by purpose
- Easy to navigate
- Separates routine changes from emergencies
- Simple and straightforward
- Chronological ordering
- Easy to understand
For State-Based Workflow (SDL)
The recommended layout is aschema/ directory holding Bytebase’s multi-file schema export - one object per file, grouped by type. The SQL Review CI and Release examples match this layout with schema/**:
- PostgreSQL
- MySQL
schema/public.sql, schema/analytics.sql) or split by object type (01_tables.sql, 02_indexes.sql, …).- One object per file makes code reviews and Git diffs precise
- Matches the Bytebase export, so adoption requires no manual reorganization
- Predictable file structure
Hybrid Approach
Combine both workflows for different purposes:- Teams wanting declarative schema management
- Projects requiring data migrations
- Gradual migration from versioned to SDL
Documentation Structure
Maintain supporting documentation alongside migrations:Next Steps
Migration Guidelines
Learn version numbering and file best practices
Git and CI/CD
Set up branching strategies and pipelines

