Changes between Initial Version and Version 8 of Ticket #2720


Ignore:
Timestamp:
Sep 26, 2006, 11:29:39 AM (18 years ago)
Author:
Adrian Holovaty
Comment:

Fixed formatting in description.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2720 – Description

    initial v8  
    11Django uses the following syntax to define foreign keys under MySQL/InnoDB:
    22
     3{{{
    34CREATE TABLE `system_script_queue` (
    45    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
     
    78    `system_script_id` integer NOT NULL REFERENCES `system_script` (`id`)
    89);
     10}}}
    911
    1012Using that syntax, maybe 1/3 of my foreign key constraints are being ignored by the DB.
     
    1214If 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:
    1315
     16{{{
    1417CREATE TABLE `system_script_queue` (
    1518    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
     
    1922    foreign key (`system_script_id`) references `system_script` (`id`)
    2023);
     24}}}
    2125
    2226Using this syntax, all of my foreign key constraints seem to be successfully created.
Back to Top