Opened 17 years ago
Closed 17 years ago
#5729 closed (fixed)
Django doesn't create real foreign keys when using MySQL INNODB engine
Reported by: | mattdennewitz | Owned by: | Malcolm Tredinnick |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Keywords: | ||
Cc: | mir@… | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
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.
Change History (4)
comment:1 by , 17 years ago
Owner: | changed from | to
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 17 years ago
Cc: | added |
---|
comment:4 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
(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.
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. :-(