[Django] #24135: migrations.RenameModel does not rename m2m tables

15 views
Skip to first unread message

Django

unread,
Jan 12, 2015, 8:37:40 AM1/12/15
to django-...@googlegroups.com
#24135: migrations.RenameModel does not rename m2m tables
---------------------------------+------------------------
Reporter: eldamir | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.7
Severity: Release blocker | Keywords: rename m2m
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------
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

--
Ticket URL: <https://code.djangoproject.com/ticket/24135>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 12, 2015, 10:46:23 AM1/12/15
to django-...@googlegroups.com
#24135: migrations.RenameModel does not rename m2m tables
---------------------------------+------------------------------------

Reporter: eldamir | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.7
Severity: Release blocker | Resolution:
Keywords: rename m2m | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by charettes):

* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* needs_tests: => 0
* needs_docs: => 0


Comment:

Managed to reproduce against master. Should this block the release of 1.8
alpha?

--
Ticket URL: <https://code.djangoproject.com/ticket/24135#comment:1>

Django

unread,
Jan 12, 2015, 10:50:37 AM1/12/15
to django-...@googlegroups.com
#24135: migrations.RenameModel does not rename m2m tables
---------------------------------+------------------------------------
Reporter: eldamir | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7

Severity: Release blocker | Resolution:
Keywords: rename m2m | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by timgraham):

* type: Uncategorized => Bug


Comment:

I presume it's an existing bug on 1.7 as well, in which case no.

--
Ticket URL: <https://code.djangoproject.com/ticket/24135#comment:2>

Django

unread,
Jan 15, 2015, 8:48:09 AM1/15/15
to django-...@googlegroups.com
#24135: migrations.RenameModel does not rename m2m tables
---------------------------------+-------------------------------------
Reporter: eldamir | Owner: timgraham
Type: Bug | Status: assigned
Component: Migrations | Version: 1.7

Severity: Release blocker | Resolution:
Keywords: rename m2m | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+-------------------------------------
Changes (by timgraham):

* status: new => assigned
* owner: nobody => timgraham


--
Ticket URL: <https://code.djangoproject.com/ticket/24135#comment:3>

Django

unread,
Jan 15, 2015, 9:57:29 AM1/15/15
to django-...@googlegroups.com
#24135: migrations.RenameModel does not rename m2m tables
---------------------------------+-------------------------------------
Reporter: eldamir | Owner: timgraham
Type: Bug | Status: assigned
Component: Migrations | Version: 1.7
Severity: Release blocker | Resolution:
Keywords: rename m2m | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+-------------------------------------
Changes (by timgraham):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/3923 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/24135#comment:4>

Django

unread,
Jan 15, 2015, 12:16:25 PM1/15/15
to django-...@googlegroups.com
#24135: migrations.RenameModel does not rename m2m tables
-------------------------------------+-------------------------------------

Reporter: eldamir | Owner: timgraham
Type: Bug | Status: assigned
Component: Migrations | Version: 1.7
Severity: Release blocker | Resolution:
Keywords: rename m2m | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by charettes):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/24135#comment:5>

Django

unread,
Jan 15, 2015, 8:36:49 PM1/15/15
to django-...@googlegroups.com
#24135: migrations.RenameModel does not rename m2m tables
-------------------------------------+-------------------------------------
Reporter: eldamir | Owner: timgraham
Type: Bug | Status: closed
Component: Migrations | Version: 1.7
Severity: Release blocker | Resolution: fixed

Keywords: rename m2m | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"28db4af80a319485c0da724d692e2f8396aa57e3"]:
{{{
#!CommitTicketReference repository=""
revision="28db4af80a319485c0da724d692e2f8396aa57e3"
Fixed #24135 -- Made RenameModel rename many-to-many tables.

Thanks Simon and Markus for reviews.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24135#comment:6>

Django

unread,
Jan 15, 2015, 8:45:05 PM1/15/15
to django-...@googlegroups.com
#24135: migrations.RenameModel does not rename m2m tables
-------------------------------------+-------------------------------------
Reporter: eldamir | Owner: timgraham
Type: Bug | Status: closed
Component: Migrations | Version: 1.7

Severity: Release blocker | Resolution: fixed
Keywords: rename m2m | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"065b2a82f6d7539032e15308351fa5eee95c0cb9"]:
{{{
#!CommitTicketReference repository=""
revision="065b2a82f6d7539032e15308351fa5eee95c0cb9"
[1.7.x] Fixed #24135 -- Made RenameModel rename many-to-many tables.

Thanks Simon and Markus for reviews.

Backport of 28db4af80a319485c0da724d692e2f8396aa57e3 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24135#comment:7>

Reply all
Reply to author
Forward
0 new messages