⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Grocery Crud ignoring foreign key "restrict" contraints



DerRobert
  • profile picture
  • Member

Posted 12 January 2018 - 12:08 PM

I have a weird problem:

 

I have three tables:

 

- rooms

- contracts

- contracts_rooms

 

contracts_rooms has two FKs pointing to the ID fields of rooms and contracts. the FK relation for rooms.id has a "restrict" for delete/update. 

in grocery crud I make use of the set_relation_n_n function.

 

I still can can delete a room in my rooms table without any restriction / warning before deletion. also, the entry in contracts_rooms is deleted but there is an orphaned "contracts" record left then.

manipulating the database directly via phpmyadmin gives me the usual "can not update" etc. error due to the constraint.

 

what is the magic of grocery crud behind that behaviour? ;-) does it remove the record from the junction table first and then removes the "room" record?