#25168: Document how to avoid foreign key constraint error after upgrade to 1.8
-------------------------------------+-------------------------------------
     Reporter:  rwillmer             |                    Owner:  rwillmer
         Type:                       |                   Status:  assigned
  Cleanup/optimization               |
    Component:  Documentation        |                  Version:  1.8
     Severity:  Normal               |               Resolution:
     Keywords:  foreign key          |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by rwillmer):

 Suggested addition to
 https://docs.djangoproject.com/en/1.8/topics/migrations/#adding-
 migrations-to-apps (and the FAQ?)

 Note: If you have upgraded to 1.8 or later from a previous version, and
 are getting a "Foreign Key constraint" error, check that you have created
 and fake-applied your initial migrations for all your apps. Without this,
 the tables will be created in the wrong order, which causes this error.

 If you have made no migrations, then you can do this project-wide with:
 $ python manage.py make migrations
 $  python manage.py migrate --fake-initial

 If you have made some, but not all, migrations, then you can do this on
 each remaining app with:
 $ python manage.py make migrations your_app_label
 $  python manage.py migrate --fake-initial your_app_label

--
Ticket URL: <https://code.djangoproject.com/ticket/25168#comment:2>
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/066.ae8d24812289618599fad67e6d272db9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to