Answers for "cannot delete or update a parent row: a foreign key constraint fails in mysql"

SQL
2

mysql cannot delete or update a parent row

# THIS SHOULD ONLY BE USED AS A LAST RESORT
SET FOREIGN_KEY_CHECKS=0; -- to disable them
SET FOREIGN_KEY_CHECKS=1; -- to re-enable them
Posted by: Guest on January-28-2021
0

Cannot delete or update a parent row: a foreign key constraint fails (

ALTER TABLE "appointments" DROP FOREIGN KEY "appointments_user_id_foreign";

ALTER TABLE "appointments" ADD CONSTRAINT "appointments_user_id_foreign" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE;
Posted by: Guest on March-09-2021

Code answers related to "cannot delete or update a parent row: a foreign key constraint fails in mysql"

Code answers related to "SQL"

Browse Popular Code Answers by Language