Hi, I get a MySQL error (colliding index names) when trying to redefine a foreign key:
Following generated SQL fails:
ALTER TABLE `gallery_image`
DROP FOREIGN KEY `gallery_image_FK_3`
ADD CONSTRAINT `gallery_image_FK_3` FOREIGN KEY `gallery_image_FK_3` (`COLUMN_NAME`)
REFERENCES [more stuff here];
... with error message ...
ERROR 1005 (HY000) at line 26: Can't create table 'DATABASENAME.#sql-45c_e7' (errno: 121)
That error goes away if I split the statement in two ...
ALTER TABLE `gallery_image`
DROP FOREIGN KEY `gallery_image_FK_3`;
ALTER TABLE `gallery_image`
ADD CONSTRAINT `gallery_image_FK_3` FOREIGN KEY `gallery_image_FK_3` (`COLUMN_NAME`)
REFERENCES [more stuff here];
... so It seems that if both alterations are in a single statement - even though it first drops the key and then recreates it - the name still collides.
Hi, I get a MySQL error (colliding index names) when trying to redefine a foreign key:
Following generated SQL fails:
... with error message ...
That error goes away if I split the statement in two ...
... so It seems that if both alterations are in a single statement - even though it first drops the key and then recreates it - the name still collides.