A Pony On The Move: How Migrations Work In Django π
summary
Explains how Django migrations actually work by naming the concrete components: MigrationLoader, MigrationRecorder and MigrationExecutor, and showing how the migration graph and dependency resolution pick the next file to run. Demonstrates the difference between ProjectState vs database (operations mutate project state first then run SQL), inspects real operation classes like CreateModel, RemoveConstraint and RunPython, and shows when squashing or fake-applies break. Includes how to read and test a migration file and what fails at apply vs unapply.
AI-written summary Β· about
