mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #3615: Added support for loading fixtures with forward references on database backends (such as MySQL/InnoDB) that do not support deferred constraint checking. Many thanks to jsdalton for coming up with a clever solution to this long-standing issue, and to jacob, ramiro, graham_king, and russellm for review/testing. (Apologies if I missed anyone else who helped here.)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16590 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e3c89346d2
commit
be87f0b0ec
16 changed files with 356 additions and 23 deletions
|
@ -142,6 +142,18 @@ currently the only engine that supports full-text indexing and searching.
|
|||
The InnoDB_ engine is fully transactional and supports foreign key references
|
||||
and is probably the best choice at this point in time.
|
||||
|
||||
.. versionchanged:: 1.4
|
||||
|
||||
In previous versions of Django, fixtures with forward references (i.e.
|
||||
relations to rows that have not yet been inserted into the database) would fail
|
||||
to load when using the InnoDB storage engine. This was due to the fact that InnoDB
|
||||
deviates from the SQL standard by checking foreign key constraints immediately
|
||||
instead of deferring the check until the transaction is committed. This
|
||||
problem has been resolved in Django 1.4. Fixture data is now loaded with foreign key
|
||||
checks turned off; foreign key checks are then re-enabled when the data has
|
||||
finished loading, at which point the entire table is checked for invalid foreign
|
||||
key references and an `IntegrityError` is raised if any are found.
|
||||
|
||||
.. _storage engines: http://dev.mysql.com/doc/refman/5.5/en/storage-engines.html
|
||||
.. _MyISAM: http://dev.mysql.com/doc/refman/5.5/en/myisam-storage-engine.html
|
||||
.. _InnoDB: http://dev.mysql.com/doc/refman/5.5/en/innodb.html
|
||||
|
|
|
@ -235,6 +235,9 @@ Django 1.4 also includes several smaller improvements worth noting:
|
|||
to delete all files at the destination before copying or linking the static
|
||||
files.
|
||||
|
||||
* It is now possible to load fixtures containing forward references when using
|
||||
MySQL with the InnoDB database engine.
|
||||
|
||||
.. _backwards-incompatible-changes-1.4:
|
||||
|
||||
Backwards incompatible changes in 1.4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue