#2720: Wrong syntax generated for foreign keys under MySQL/InnoDB 5.0.22
------------------------------+---------------------------------------------
 Reporter:  anonymous         |       Owner:  adrian            
     Type:  defect            |      Status:  new               
 Priority:  high              |   Milestone:                    
Component:  Database wrapper  |     Version:                    
 Severity:  normal            |    Keywords:  innodb foreign key
------------------------------+---------------------------------------------
 Django uses the following syntax to define foreign keys under
 MySQL/InnoDB:
 
 CREATE TABLE `system_script_queue` (
     `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
     `execution_time` datetime NOT NULL,
     `period` integer NOT NULL,
     `system_script_id` integer NOT NULL REFERENCES `system_script` (`id`)
 );
 
 Using that syntax, maybe 1/3 of my foreign key constraints are being
 ignored by the DB.
 
 If I'm reading this tech note correctly
 (http://dev.mysql.com/doc/refman/5.0/en/example-foreign-keys.html), that's
 the wrong syntax to use.  The correct syntax is this one:
 
 CREATE TABLE `system_script_queue` (
     `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
     `system_script_id` integer NOT NULL,
     `execution_time` datetime NOT NULL,
     `period` integer NOT NULL,
     foreign key (`system_script_id`) references `system_script` (`id`)
 );
 
 Using this syntax, all of my foreign key constraints seem to be
 successfully created.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/2720>
Django <http://code.djangoproject.org/>
The web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---

Reply via email to