#23013 closed Bug (fixed)
Removing unique_together constraint from model fails
Reported by: | Stephen Burrows | Owned by: | Tim Graham |
---|---|---|---|
Component: | Migrations | Version: | 1.7-rc-1 |
Severity: | Release blocker | Keywords: | |
Cc: | Stephen Burrows | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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
Attachments (1)
Change History (6)
by , 10 years ago
Attachment: | 23013.diff added |
---|
comment:1 by , 10 years ago
Has patch: | set |
---|---|
Needs tests: | set |
Triage Stage: | Unreviewed → Accepted |
Will try to finish tomorrow if no one beats me to it.
comment:2 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Still need to add a test for changes to state.py