#29177: Unmanaged models with ForeignKeys do not get those fields serialized
into
their migration state when CreateModel happens.
------------------------------+-----------------------------------------
Reporter: Keryn Knight | Owner: Michal Mládek
Type: Bug | Status: assigned
Component: Migrations | Version: dev
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 Michal Mládek):
Replying to [comment:16 Michal Mládek]:
Finally, there is problem only with FK. I made a mistake while I was
testing unmanaged models migrations.
> I have created a Django project named **dj_bug_29177**. It contains an
app called **foo** with models and migrations written in such a way that
the reported bug is triggered. Additionally, I’ve added code that
generalizes the issue - **this bug occurs for any column added to model
B**. The error disappears if I **uncomment lines 19 and 20** in migration
**foo 0001**. I confirm that the issue is not related to the SQL generated
by the **python manage.py migrate** command, but rather to the **python
manage.py makemigrations** command. The bug affects any column used in an
unmanaged model, except for id. The **solution is** to fix the Django
project code so that **all fields defined on unmanaged models are included
in automatically generated migrations**. I will try to check today whether
the ticket already contains a test; if not, I’ll attempt to write one. As
it is described [https://docs.djangoproject.com/en/dev/intro/contributing
/#writing-some-tests-for-your-ticket here] it must be regression test.
--
Ticket URL: <https://code.djangoproject.com/ticket/29177#comment:17>
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 visit
https://groups.google.com/d/msgid/django-updates/01070196b0d7ca1f-f8983726-aba4-41c5-8824-58db10895163-000000%40eu-central-1.amazonses.com.