#23630: AlterModelTable doesn't rename auto-created tables
---------------------------------+------------------------------------
Reporter: Naddiseo | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by shaib):
* severity: Normal => Release blocker
Old description:
> `AlterModelTable` only renames a model's table, but doesn't rename
> corresponding tables created for m2m fields.
New description:
According to https://docs.djangoproject.com/en/dev/ref/models/fields/#ref-
manytomany, when a m2m field uses an automatic (implicit) through model,
the through model's table is named by combining the containing model's
table-name and the field name. Consequently, if a model contains such m2m
fields and its table name is changed by a migration, the m2m field's
tables should also be renamed.
This doesn't happen (see comment:4 and comment:5 for details), leading to
broken models.
--
Comment:
I've been able to reproduce the problem as described in comment:4. I've
also verified that this is independent of whether the (main) models use
the default table name -- the behavior is the same when changing from non-
default to default (as in comment:4), from default to non-default, or
between two different non-default names.
Marking as a release blocker as well -- this is, IMO, as important as
#23629.
--
Ticket URL: <https://code.djangoproject.com/ticket/23630#comment:5>
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/066.b1cf7dc211dfd10137242dfebd7d7608%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.