How to get the information to update an already existing foreign key..
When updating a foreign key referemce in phpmyadmin this query is sent to the server
ALTER TABLE `dimension` ADD FOREIGN KEY (`test_id`) REFERENCES `db`.`test`
(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
But how do I get the status ON DELETE and ON UPDATE to sending and updating the alter table query?
You can’t. You have to drop the existing foreign key constraint and add a new one.
However, you can fetch the existing
reference_optionfrom theINFORMATION_SCHEMA:Or else from
SHOW CREATE TABLE: