The Anatomy of Django Migrations
summary
Explains exactly how Django turns model edits into applied schema changes by using ModelState/AppState/ProjectState snapshots, an autodetector and questioner that rejects adding a non-null field without a default and prompts for values, and a migration graph (built by Loader) that uses depth‑first search to order nodes while Executor runs the plan. Mentions runpython for custom SQL, the South-to-core merge (PR #376 ~6,000 lines), and tooling for visualizing migration graphs.
AI-written summary · about
chapters (11)
- 0:00Introduction to Django Migrations
- 3:22How Django Migrations Work
- 7:26ModelState vs Actual Model
- 9:48Handling Non-null Fields
- 11:57Autodetector and Questioner
- 12:17Migration Graph and DFS
- 15:44Reliability of Migration Graphs
- 16:29Loader and Executor Components
- 18:14History of Django Migrations
- 19:41Why Migrations Matter Beyond Django
- 20:50Q&A Session
