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)
Option 1: Organized by Schema- Clear schema separation
- Matches database structure
- Easy to find objects
- Organized by DDL type
- Predictable file structure
- Clear dependencies (tables before indexes)
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

