error 1451 (23000): cannot delete or update a parent row: a foreign key constraint fails
SET FOREIGN_KEY_CHECKS = 0; -- to disable FK checks (ex: for delete purpose)
SET FOREIGN_KEY_CHECKS = 1; -- to re-enable FK checks
error 1451 (23000): cannot delete or update a parent row: a foreign key constraint fails
SET FOREIGN_KEY_CHECKS = 0; -- to disable FK checks (ex: for delete purpose)
SET FOREIGN_KEY_CHECKS = 1; -- to re-enable FK checks
sqlstate[23000]: integrity constraint violation: 1451 cannot delete or update a parent row:
Schema::disableForeignKeyConstraints();
Schema::dropIfExists('tablename');
Schema::enableForeignKeyConstraints();
ERROR 1451: 1451: Cannot delete or update a parent row: a foreign key constraint fails
SET FOREIGN_KEY_CHECKS=0; -- to disable them
SET FOREIGN_KEY_CHECKS=1; -- to re-enable them
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us