Migration-based database delivery represents schema changes as explicit, ordered migrations that move a database from one version to another. Store these migrations with regular code in source control, creating a single source of truth and preserving change history. section 10.0 section 10.1
Prefer this approach because it:
- Makes each schema transition visible rather than deriving it implicitly from differences between database states. section 10.7
- Handles data motion more effectively, which outweighs the easier merge-conflict handling offered by state-based delivery. section 10.7
- Requires every schema and reference-data modification to pass through a migration. section 10.7
An explicit migration
A migration named CreateUserTable defines an Up operation that creates the Users table and a Down operation that deletes it. The paired operations make the transition and its reversal concrete.
