#25551: makemigrations when adding a ForeignKey to a newly created model along with a unique_together constraint must create fields before the unique_together constraint ----------------------------+--------------------------------------- Reporter: mssnlayam | Owner: avojnovicDk Type: Bug | Status: assigned Component: Migrations | Version: 1.8 Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ----------------------------+--------------------------------------- Changes (by avojnovicDk):
* has_patch: 0 => 1 Comment: This happens for the very specific edge case: If you create a model, make migrations for that model, and then add a foreign key to another model that didn't exist previously with unique together, the order of the action in the new migration will not be correct: it will try to alter unique together and then add the field used in unique together. I made PR with fix for this. -- Ticket URL: <https://code.djangoproject.com/ticket/25551#comment:3> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.ad8dbfee20546755d5ef44c2ded5bca2%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.