Django

Code

Ticket #5729 (closed: fixed)

Opened 9 months ago

Last modified 9 months ago

Django doesn't create real foreign keys when using MySQL INNODB engine

Reported by: mattdennewitz Assigned to: mtredinnick
Milestone: Component: Database wrapper
Version: SVN Keywords:
Cc: mir@noris.de Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

When specifying in DATABASE_OPTIONS to use MySQL's INNODB engine, Django will oblige and create the tables using MySQL. It won't, however, create real foreign keys; instead, it adds indexes as though it were using MyISAM.

Attachments

Change History

10/10/07 12:09:27 changed by mtredinnick

  • owner changed from nobody to mtredinnick.
  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • needs_docs changed.

Yep. I noticed this recently when switching to MySQL for a project. I've got a fix for this that I've been debugging in my local tree. I'll commit it shortly.

One day the MySQL devs will really have to implement the correct syntax handling. :-(

10/11/07 05:37:47 changed by mir

  • cc set to mir@noris.de.

10/13/07 13:23:49 changed by mattdennewitz

thanks!

11/04/07 00:05:25 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [6650]) Fixed #5729 -- For MySQL (only), always delay the creation of foreign key references, for all tables, until after the table has been created. This means that when using the InnoDB storage engine, true foreign key constraints are created (inline "REFERENCES" are ignored by InnoDB, unfortunately).

Fully backwards compatible.


Add/Change #5729 (Django doesn't create real foreign keys when using MySQL INNODB engine)




Change Properties
Action