#30966: Migration crashes due to foreign key issue, depending on otherwise
irrelevant order on MySQL.
-------------------------------------+-------------------------------------
Reporter: Peter Thomassen | Owner: Hasan
| Ramezani
Type: Bug | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: migration mySQL | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):
From giving a quick look at the current implementation it looks we're
unfortunately sharing `__fake__` models bound to different `StateApps` for
performance reason to work around the fact the schema editors are still
operating from model classes instead of model states #29898.
Since we'll likely won't be able to prevent this sharing from taking place
in the short term for performance reasons we should investigate ''why''
the models cache is not appropriately busted to avoid having two different
`Options` instances for the `User` model. In this case it looks like the
`Token` fake model is not reloaded while the `RRset`, `User`, and `Domain`
ones are when the `AlterField(model_name="RRset")` is performed. That
makes `Token.user` point to the ''stale'' `User` model and `Domain.owner`
point to the new one.
I highly suspect this ticket is related to #27737 and
[https://github.com/django/django/blob/b93a0e34d9b9b99d41103782b7e7aeabf47517e3/django/db/migrations/operations/fields.py#L231-L239
this TODO] in `AlterField.state_forwards`.
--
Ticket URL: <https://code.djangoproject.com/ticket/30966#comment:7>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/072.9f520c66ea9e6cf7262ea4456b5d7f8b%40djangoproject.com.