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.
精彩评论