#24537: Migration autodetector not detecting RenameModel if foreign keys are
defined before sibling fields
----------------------------+-------------------------
Reporter: rapilabs | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: master
Severity: Normal | Keywords: RenameModel
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+-------------------------
(This may be related to #22931 as there was some discussion about failure
to detect model renaming there, although that ticket focused more on
exceptions being raised.)
Django Migrations seems to generate model migrations with foreign keys
placed last in a CreateModel migration, regardless of where they are
defined in the model. This can affect later model renames as the
autodetector fails to recognise that the model is the same; the newly
generated model state will have the same order as the model.
I've created a test case to confirm that the autodetector won't detect a
rename if the foreign keys are in a different order:
https://github.com/rapilabs/django/blob/master/tests/migrations/test_autodetector.py#L660
--
Ticket URL: <https://code.djangoproject.com/ticket/24537>
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/051.c891ceb165395f64caa9eeadc510b6d1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.