Migrations
Browse the documentation in this section.
Managed migrations
The declare → migrate → change → migrate cycle, on by default.
inspectdb
Introspect an existing database into models and a 0001_initial migration.
Recovering from migration drift
What to do when the tracking table and migration files on disk get out of sync.
Adding NOT NULL columns to existing tables
How to safely add NOT NULL columns to populated tables without losing data, with backend-specific notes for SQLite and Postgres.
Checking migrations for zero-downtime safety
The checkmigrations command flags destructive or non-atomic operations before you deploy without a maintenance window.
Data migrations (RunSql)
Hand-authored raw-SQL migrations that change rows, not the schema.