#22248 closed Bug (fixed)
Model renaming doesn't work backwards
Reported by: | Andrew Godwin | Owned by: | Andrew Godwin |
---|---|---|---|
Component: | Migrations | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Stratos Moros, info+coding@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
Because of the way ModelRename also triggers AlterField on the foreign keys of other models, it doesn't work in reverse, as that way round the foreign keys are repointed to the old model before it is re-created.
Since some backends (e.g. PostgreSQL) repoint constraints along with renames, we need to make sure that no AlterField is triggered with a rename and then have RenameModel deal with the FKs on MySQL (and perhaps Oracle?)
Change History (13)
comment:1 by , 11 years ago
Status: | new → assigned |
---|
comment:2 by , 11 years ago
Severity: | Release blocker → Normal |
---|
comment:3 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:4 by , 11 years ago
There's a test in tests/migrations/test_operations.py (test_rename_model_with_related) that should be uncommented when this is fixed.
comment:5 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:7 by , 10 years ago
Cc: | added |
---|---|
Resolution: | fixed |
Status: | closed → new |
Although this seems to be fixed by b568bdf, RenameModel.reversible is still False making RenameModel unreversible.
comment:8 by , 10 years ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Unreviewed |
I've made a pull request for this: https://github.com/django/django/pull/3572.
comment:9 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|
The Triage State refers to the ticket and not the patch.
Having Has patch checked with Patch needs improvement unchecked will ensure your patch shows up in the review queue.
comment:10 by , 10 years ago
Sorry about that, this is my first code contribution to Django. I'll keep it in mind for the future.
comment:11 by , 10 years ago
Cc: | added |
---|---|
Needs documentation: | set |
Patch needs improvement: | set |
comment:12 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I'm marking model renames as irreversible for now in order to move this away from release blocker status; there's other irreversible core operations, and we can address this if we get time before the final.