#24135 closed Bug (fixed)
migrations.RenameModel does not rename m2m tables
Reported by: | Ruben Nielsen | Owned by: | Tim Graham |
---|---|---|---|
Component: | Migrations | Version: | 1.7 |
Severity: | Release blocker | Keywords: | rename m2m |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Observe the following models
class Tag(Model): content = Charfield(...) class CustomerModel(Model): keywords = ManyToManyField('Tag')
this will generate 3 tables
applabel_customermodel applabel_tag applabel_customermodel_keywords
when I try to rename CustomerModel to Customer in a migration, the autogenerated table is not renamed
migration:
operations = [ migrations.RenameModel('CustomerModel', 'Customer'), ]
tables:
applabel_customer applabel_tag applabel_customermodel_keywords
This causes my code to fail, since lookups on customer.keywords.all() expect to find the table applabel_customer_keywords, which does not exist.
The error is observed in 1.7.1 and 1.7.2
Change History (7)
comment:1 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 10 years ago
Type: | Uncategorized → Bug |
---|
I presume it's an existing bug on 1.7 as well, in which case no.
comment:3 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:5 by , 10 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:6 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Managed to reproduce against master. Should this block the release of 1.8 alpha?