#26180: Altering unique_together still sometimes missing deleted fields
-------------------------------+--------------------
Reporter: julianandrews | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
This is likely a missed edge case from #23614.
Steps to reproduce:
1. Create an app `spam`
2. Create a model `Spam`
{{{
class Spam(models.Model):
a = models.CharField(max_length=255)
b = models.CharField(max_length=255)
c = models.CharField(max_length=255)
class Meta:
unique_together = (
('a', 'b'),
('b', 'c'),
)
}}}
3. Make migrations
4. Delete field `Spam.c`
5. Delete the second `unique_together` constraint (`('b', 'c')`)
6. Make migrations
7. Run migrations
Output:
{{{
django.core.exceptions.FieldDoesNotExist: Spam has no field named u'c'
}}}
Note that the bug doesn't occur if no `unique togther` constraints remain.
Manually reversing the order of the operations in the migration (to remove
the index first) produces a functional migration.
--
Ticket URL: <https://code.djangoproject.com/ticket/26180>
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/056.ada3edb0f9313e6575116119915e5cf1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.