Migrating to Success: Unleashing the Power of Django Migrations
summary
Explains concrete migration commands and tradeoffs: use makemigrations, migrate, showmigrations and sqlmigrate; use RunPython or JSON fixtures to move data; CI test setup with seed database (dump and restore) cuts test DB setup from ~20s to about 2s plus 1s test; --keepdb saves ~20s after the first run; squashmigrations only saves ~1s; full rebuild of a single initial migration yields ~5s create and 2s tests but requires heavy manual work.
AI-written summary · about
chapters (11)
- 0:00Django migrations intro
- 2:21What migrations are
- 4:50Core commands workflow
- 7:16Modifying models fields
- 9:06Data migrations custom ops
- 11:18Renaming fields initial data
- 13:25Migrations testing CI/CD
- 16:40Test perf with seed DBs
- 18:46Squashing migrations trade-offs
- 19:48Recreate migrations from scratch
- 20:32Summary
related talks
26mDjango migrations, friend or foe? Optimize them for testing
43mDigging Into Django's Migrations
23mBeyond the Basics of Migrations
21mDjango's Migrations: A Retrospective
27mMigrating legacy data to your Django project
57mDjangoCon 2008 Panel: Schema Evolution
12mStrategies for handling conflicts and rollbacks in Django database migrations
29mMigrating Data Quickly and Safely
