I've got 3 tables (I'll mention only attributes that are needed):
import id
, date
import_head id
, import_id
import_body id
, import_head_id
import_head
and import_body
create one import item, import is created by dozens of import item Relations: import 1 <==> N *import_head* 1 <==> 1 *import_body* (ON DELETE CASCADE on every relation)
How can delete all import items when deleting row from import table?
When deleting import using DELETE FROM import WHERE id = ?
error is thrown: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails
- on import_head_id
Thanks a lot in advance
I have changed entities in DB, so now there are only two tables:
import
import_item
I haven't found anything better, but it works.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments