The Wire · Showcase
DJANGO FIXES MIGRATION CRASH THAT BREAKS UNIQUE CONSTRAINTS
By RepoJournal · Filed · About Django
A critical bug in Django's migration system is now patched: CreateModel with unique_together no longer crashes when followed by AlterUniqueTogether in the same migration.
The fix [1] resolves a crash that occurred when migrations contained both operations in sequence. Django was attempting to remove a unique constraint that existed only in deferred SQL, causing the alter operation to fail. This is the kind of silent killer that ships to production undetected until you run a specific migration sequence. In parallel, the docs got a significant boost with new guidance on test performance [2]. The team added explicit documentation showing how setUpTestData dramatically speeds up test suites by reusing data across tests, with revised examples that actually demonstrate the isolation mechanics. Secondary fixes landed on password hashing anchor links [3] and the steering council published June meeting notes [4]. ASV benchmarks also updated with ubuntu-latest results [5], keeping the performance baseline current.
Action items
- → Upgrade Django to patch version containing fix #31317 before your next migration deployment django/django [immediate]
- → Review your test suite for setUpTestData opportunities using the updated documentation django/django [plan]
References
- [1] Fixed #31317 -- Avoided crash in CreateModel with unique_together and AlterUniqueTogether. ↗ django/django
- [2] Fixed #37128 -- Doc'd setUpTestData as test speed up. django/django
- [3] Fixed password hashing anchor link for references. django/django
- [4] Add 2026-06-15 meeting notes django/steering-council
- [5] Results for ubuntu-latest added [skip ci] django/django-asv
FAQ
- What changed in Django on June 16, 2026?
- A critical bug in Django's migration system is now patched: CreateModel with unique_together no longer crashes when followed by AlterUniqueTogether in the same migration.
- What should Django teams do about it?
- Upgrade Django to patch version containing fix #31317 before your next migration deployment • Review your test suite for setUpTestData opportunities using the updated documentation
- Which Django repositories shipped on June 16, 2026?
- django/django, django/steering-council, django/django-asv