#29177: Unmanaged models with ForeignKeys do not get those fields serialized
into
their migration state when CreateModel happens.
------------------------------+------------------------------------
Reporter: Keryn Knight | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Comment (by Simon Charette):
Sergey,
> Unmanaged models should not work in migrations by their nature.
Is there a reason for that? How would the migration framework know how to
generate references from managed models to unmanaged ones then (e.g. a
foreign key)? The migration framework has supported managed model
references for a while and even
[https://docs.djangoproject.com/en/2.1/howto/writing-migrations/#changing-
an-unmanaged-model-to-managed documents how to move an unmanaged model to
a managed one].
> You can make direct import of this model in migrations and use it.
Direct model imports in migrations will break over time if the model
definition happen to change and won't work when mixed up with
state/migration models. The
[https://docs.djangoproject.com/en/2.1/topics/migrations/#historical-
models documentation warns about this pattern].
I still believe this is a legitimate bug.
--
Ticket URL: <https://code.djangoproject.com/ticket/29177#comment:10>
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/067.7a0fa28ae1975e4968910d472dd19814%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.