开发者

Is it possible to alter the cascading behaviour of existing mysql foreign keys?

开发者 https://www.devze.com 2022-12-31 07:28 出处:网络
I have two tables in mysql, both are type InnoDB and there is an existing foreign key from the first to the second.

I have two tables in mysql, both are type InnoDB and there is an existing foreign key from the first to the second.

However, the foreign key was created without any cascading behaviour. The table is large, and any changes to indexes or new keys locks the table for ~20 minutes.

Is it possible to add "ON DELETE CASCADE" behaviour to an existing foreign key without dr开发者_如何转开发opping the key and recreating it?


Unfortunately, no. On Delete and On Update are systemic attributes of the foreign key itself and can only be specified when creating the constraint.

0

精彩评论

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