Search
 
SCRIPT & CODE EXAMPLE
 

SQL

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 
Comment

sqlstate[23000]: integrity constraint violation: 1451 cannot delete or update a parent row:

Schema::disableForeignKeyConstraints();
Schema::dropIfExists('tablename');
Schema::enableForeignKeyConstraints();
Comment

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
Comment

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

ALTER TABLE `advertisers`
  ADD CONSTRAINT `advertisers_ibfk_1` FOREIGN KEY (`advertiser_id`) 
      REFERENCES `jobs` (`advertiser_id`);
Comment

PREVIOUS NEXT
Code Example
Sql :: sqlite3 read only 
Sql :: shrink database file in sql server 
Sql :: convert rows to string sql server 
Sql :: create index concurrently postgres 
Sql :: how to delete a record from sqlite in android 
Sql :: postgres select max value 
Sql :: sqlite3 show columns name 
Sql :: begin transaction in sql 
Sql :: mysql query bulk insert 
Sql :: sql where max date 
Sql :: sql server: difference between hashtable and table declared using declare keyword 
Sql :: tsql insert 
Sql :: sql unique rows 
Sql :: mysql average of multiple columns 
Sql :: foreign key mysql 
Sql :: MYSQL select last query 
Sql :: create or replace table sql 
Sql :: SQL Auto Increment Primary Key - SQL Server 
Sql :: Assign value to var in SQL 
Sql :: mariadb alter table add column if not exists example 
Sql :: get current month last date in sql server 
Sql :: count column of tables psql 
Sql :: insert current date sql 
Sql :: store select query result in variable sql server 
Sql :: sql compare strings 
Sql :: extract weekday from date in sql 
Sql :: mysql count number of occurrences in a column 
Sql :: SQL DEFAULT Constraint With Alter Table 
Sql :: mysql show schema 
Sql :: postgres set null 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =