views:

38

answers:

1

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 dropping the key and recreating it?

+3  A: 

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

Thomas