Come Fly With Me: Database Migration Patterns with Flyway
summary
Flyway provides versioned SQL/Java migrations, stores checksums in a schema table and fails if applied migrations change, and uses transactional DDL where supported (Postgres) unlike non‑transactional MySQL. Patterns covered: use dotted versions like 1.1 for maintenance patches so production patches sit between releases; enable outOfOrder on CI/test to accept feature-branch timestamps; use multiple migration locations to serve DB‑specific SQL or production-only data fixes; and baseline/rebase to squash migrations and create per‑service schema_version tables when extracting microservices. Running at startup requires a schema‑altering DB user or run in pipeline.
AI-written summary · about
chapters (24)
- 0:00About Me
- 0:49The Problem With Databases
- 4:09Flyway
- 5:25Find Available Migrations
- 6:46Find Applied Migrations
- 7:52Validate
- 10:02Apply Migrations
- 12:12What's In A Migration?
- 13:13Usage Considerations
- 16:55Problem with Maintenance Branches
- 19:41Effect Per Environment
- 20:35Out-of-order Migrations
- 22:10Problem with Feature Branches
- 24:37Solution
- 25:39Timestamped Versions
- 28:58Migration Locations
- 30:40Multiple DBMSS & Spring Boot
- 31:07Environment-specific Migrations
- 32:24Migrations Are Forever?
- 33:03Squashing Migrations
- 35:41Rebasing When Squashing
- 39:24From Monolith To Microservices
- 40:43Shared DB Schema Evolution
- 44:13Conclusion
