#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):

 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.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/29177#comment:16>
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/01070196af9250c8-98683e81-6365-44a5-bc4d-2b5bf9d986a8-000000%40eu-central-1.amazonses.com.

Reply via email to