#28862: Removing a field from index_together/unique_together and from the model
generates a migration that crashes
-------------------------------------+-------------------------------------
     Reporter:  Artem Maslovskiy     |                    Owner:  Ramiro
                                     |  Morales
         Type:  Bug                  |                   Status:  assigned
    Component:  Migrations           |                  Version:  1.9
     Severity:  Normal               |               Resolution:
     Keywords:  models migrations    |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Ramiro Morales):

 Replying to [comment:8 Markus Holtermann]:
 > the test itself is still correct because the `RemoveField` operation
 doesn't touch any of the fields referred to in `AlterUniqueTogether` or
 `AlterIndexTogether`.

 The point I tried to make in comment:6 is that this reasoning (and hence
 the asserts of the test case) is wrong because if the user removes a field
 from the model and from Meta.*_together (the test case scenario) then it's
 wrong to optimize the sequence to have te RemoveField first even it it
 doesn't mention any of the fields which will remain in *_together.

 The asserts in the test case examine the order and type of parts of the
 generated migration and don't fail because no DLL code is executed agaonst
 the DB at that point. The breakage happens at migration application time
 when it wants to execute the Alter*Together operation.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28862#comment:9>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.c376e4d3bf734e0cbbe40ee75688a6e9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to