Skip Menu |

This queue is for tickets about the SQL-Translator CPAN distribution.

Report information
The Basics
Id: 7395
Status: new
Priority: 0/
Queue: SQL-Translator

People
Owner: Nobody in particular
Requestors: dhoworth [...] mrc-lmb.cam.ac.uk
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.05
Fixed in: (no value)



Subject: MySQL parser doesn't support ALTER TABLE ADD FOREIGN KEY
AFAIK, the only way to add a foreign key referencing a table that's not created yet is to ALTER the referring table after the referenced table is created. The creation order cannot be swapped if there is an inverse foreign key. CREATE TABLE a ( id INT, b_id INT, PRIMARY KEY (id), INDEX (b_id) ); CREATE TABLE b ( id INT, a_id INT, PRIMARY KEY (id), INDEX (a_id), FOREIGN KEY (a_id) REFERENCES a (id) ); ALTER TABLE a ADD FOREIGN KEY (b_id) REFERENCES b (id); It would be nice if the parser could handle this case. Thanks, Dave