#23013: Removing unique_together constraint from model fails
---------------------------------+----------------------
     Reporter:  melinath         |      Owner:  nobody
         Type:  Bug              |     Status:  new
    Component:  Migrations       |    Version:  1.7-rc-1
     Severity:  Release blocker  |   Keywords:
 Triage Stage:  Unreviewed       |  Has patch:  0
Easy pickings:  0                |      UI/UX:  0
---------------------------------+----------------------
 This actually fails in two places. In both cases, it is because
 `unique_together` is being set to None, and things expect it to be a list.

 First, in trying to create the migration.

 {{{
 # django/django/db/migrations/operations/models.py, line 251
 # This fails
 return "Alter %s for %s (%s constraint(s))" % (self.option_name,
 self.name, len(self.unique_together))

 # Should be
 return "Alter %s for %s (%s constraint(s))" % (self.option_name,
 self.name, len(self.unique_together) if self.unique_together is not None
 else 0)
 }}}

 Second, in trying to *run* the migration (if you fix the first issue or
 manually create a migration.

 {{{
 # django/django/db/migrations/state.py, line 276
 # This fails
 meta_contents["unique_together"] = list(meta_contents["unique_together"])

 # Should be
 meta_contents["unique_together"] = list(meta_contents["unique_together"])
 if meta_contents["unique_together"] is not None else None
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/23013>
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/051.0954575036dc14f59ecbcb93e5b83ea6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to