mysql supprimer la contrainte de clé étrangère
ALTER TABLE jobs DROP FOREIGN KEY constraint_name
Hiren Reshamwala
ALTER TABLE jobs DROP FOREIGN KEY constraint_name
SET foreign_key_checks = 0;
CREATE TABLE parent (
id INT NOT NULL,
PRIMARY KEY (id)
) ENGINE=INNODB;
CREATE TABLE child (
id INT,
parent_id INT,
INDEX par_ind (parent_id),
FOREIGN KEY (parent_id)
REFERENCES parent(id)
ON DELETE CASCADE
) ENGINE=INNODB;
ALTER TABLE table_name DROP FOREIGN KEY constraint_name
ALTER TABLE table_name
DROP FOREIGN KEY constraint_name;
Code language: SQL (Structured Query Language) (sql)