开发者

Innodb foreign key constraints

开发者 https://www.devze.com 2023-01-15 00:06 出处:网络
I am trying to change the type in two tables of an innoDB. The problem is that the values are a key and a foreign key. When I try to make the change I get the following error

I am trying to change the type in two tables of an innoDB. The problem is that the values are a key and a foreign key. When I try to make the change I get the following error

#1025 error on rename

Do I need to drop the foreign keys and the开发者_Python百科n make the changes and then reapply the foreign key?


Since u can use the name to drop the foreign key first and the column then:

ALTER TABLE categories DROP FOREIGN KEY categories_ibfk_1;
ALTER TABLE categories DROP COLUMN assets_id;

To find out which table caused the error you can run

SHOW ENGINE INNODB STATUS\G 

and then look at the "LATEST FOREIGN KEY ERROR" section.


Yeah, you have to drop the foreign key. Try SHOW INNODB STATUS to see if there's a more elaborated explanation of what's going on.

0

精彩评论

暂无评论...
验证码 换一张
取 消