Page 1 of 1

[SOLVED] Altering a foreign key

Posted: Mon Jan 08, 2007 4:34 am
by Rovas
When I created the structure of my MySQL database I chose to ignore the clause ON DELETE ... BIG mistake :oops: :(
Now I have to modify a number of foreign key to include this. I tried the ALTER COLUMN, MODIFY, but they didn' t work. I' m thinking of saving the data in the tables, droping the tables and create them again the right way. I' m not going to do this unless there won' t be other options.
Do you have any other ideas.

Posted: Mon Jan 08, 2007 8:44 am
by feyd
I think you're after...

Code: Select all

ALTER TABLE tableName CHANGE oldColumn newColumnDefinition

Posted: Wed Jan 10, 2007 3:08 am
by Rovas
Solved it using

Code: Select all

DELETE table_name.* IGNORE KEYS FROM table_name;