I maintain orm-lens (until recently django-orm-lens), a static analyzer for Django models and migrations. One of its checks, migration-risk , reads every migration file and flags operations that break on a table that already has rows: a NOT NULL column with no default, a UNIQUE column that existing duplicates will violate, an index build that locks the table.
Its test suite was green, so I pointed it at real projects:
Project GitHub stars Critical findings
NetBox 21.8k 212
PostHog 40.5k 79
authentik 26.2k 58
Healthchecks 10.5k 27
Plane 61.7k 25
paperless-ngx 47.4k 6
That is 407 critical findings . I read every one, and two were real.
The other 405 were not edge cases. Each came from something Django does when it migrates a populated table, which I had modelled wrongly. Here they are, ordered by how many false alarms each caused.
1. Squashed migrations never touch a populated table (208)
class Migration ( migrations . Migration ) : replaces = [ ( "dcim" , "0002_auto_..." ) , . . .…