Discussion:
[Django] #25168: Document how to avoid foreign key constraint error after upgrade to 1.8
Django
2015-07-23 08:39:20 UTC
Permalink
#25168: Document how to avoid foreign key constraint error after upgrade to 1.8
--------------------------------------+-------------------------
Reporter: rwillmer | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.8
Severity: Normal | Keywords: foreign key
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+-------------------------
I hit this problem myself, and eventually figured out that it was because
I hadn't created the fake install of the initial migrations for all my
apps in my Django project.

I've seen and answered a few questions caused by this on StackOverflow, so
I suspect it may be a common problem. e.g.

http://stackoverflow.com/questions/29483119/django-1-8-syncdb-not-working-
throwing-a-foreign-key-constraint-error
http://stackoverflow.com/questions/28561458/django-mysql-error-when-
creating-tables

--
Ticket URL: <https://code.djangoproject.com/ticket/25168>
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 django-updates+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/051.061c718f24c54b8cb58b16be243136e7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Django
2015-07-23 08:39:54 UTC
Permalink
#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
-------------------------------------+-------------------------------------
Changes (by rwillmer):

* owner: nobody => rwillmer
* needs_better_patch: => 0
* status: new => assigned
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/25168#comment:1>
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 django-updates+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.ea5ffee2b2c3e542b362368485f74cbc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Django
2015-07-23 08:46:28 UTC
Permalink
#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 django-updates+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
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.
Django
2015-07-23 08:46:38 UTC
Permalink
#25168: Document how to avoid foreign key constraint error after upgrade to 1.8
-------------------------------------+-------------------------------------
Reporter: rwillmer | Owner: rwillmer
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: 1.8
Severity: Normal | Resolution: fixed
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
-------------------------------------+-------------------------------------
Changes (by rwillmer):

* status: assigned => closed
* resolution: => fixed


--
Ticket URL: <https://code.djangoproject.com/ticket/25168#comment:3>
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 django-updates+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.dfc12da1203f8888258535442d898062%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Django
2015-07-23 11:40:36 UTC
Permalink
#25168: Document how to avoid foreign key constraint error after upgrade to 1.8
--------------------------------------+------------------------------------
Reporter: rwillmer | Owner: rwillmer
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.8
Severity: Normal | Resolution:
Keywords: foreign key | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* status: closed => new
* has_patch: 0 => 1
* resolution: fixed =>
* stage: Unreviewed => Accepted


Comment:

Ticket isn't marked as fixed until the patch is merged.

--
Ticket URL: <https://code.djangoproject.com/ticket/25168#comment:4>
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 django-updates+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.0448b0c579415a6e44562ede01e65628%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Django
2015-07-23 13:12:22 UTC
Permalink
#25168: Document how to avoid foreign key constraint error after upgrade to 1.8
--------------------------------------+------------------------------------
Reporter: rwillmer | Owner: rwillmer
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.8
Severity: Normal | Resolution:
Keywords: foreign key | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/25168#comment:5>
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 django-updates+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.103c738b55b4876ea2a17a80d3abb9f4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Django
2015-07-31 12:16:46 UTC
Permalink
#25168: Document how to avoid foreign key constraint error after upgrade to 1.8
--------------------------------------+------------------------------------
Reporter: rwillmer | Owner: rwillmer
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.8
Severity: Normal | Resolution: fixed
Keywords: foreign key | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"70912e137d5a6b089f35c662115fb758a00d7002" 70912e13]:
{{{
#!CommitTicketReference repository=""
revision="70912e137d5a6b089f35c662115fb758a00d7002"
Fixed #25168 -- Documented how to avoid foreign key constraint error after
upgrading to 1.8.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25168#comment:6>
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 django-updates+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.25ec0959a0a8e56bffa13ff4f18d9814%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Django
2015-07-31 12:17:07 UTC
Permalink
#25168: Document how to avoid foreign key constraint error after upgrade to 1.8
--------------------------------------+------------------------------------
Reporter: rwillmer | Owner: rwillmer
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.8
Severity: Normal | Resolution: fixed
Keywords: foreign key | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"466950fa981caf4d3149ba39f6b214413df463f3" 466950fa]:
{{{
#!CommitTicketReference repository=""
revision="466950fa981caf4d3149ba39f6b214413df463f3"
[1.8.x] Fixed #25168 -- Documented how to avoid foreign key constraint
error after upgrading to 1.8.

Backport of 70912e137d5a6b089f35c662115fb758a00d7002 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25168#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 django-updates+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.61ec45c3a4c29046cde3d5bb759af868%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Loading...