Cannot delete or update a parent row: a foreign key constraint fails (`ffo_live_2310`.`noc_details`, CONSTRAINT `noc_details_ibfk_1` FOREIGN KEY (`application_id`) REFERENCES `application_details_old` (`id`)) code example

Example: 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;

Tags:

Misc Example