Chris Muench
Chris Muench

Reputation: 18318

ON DELETE CASCADE

ALTER TABLE `phppos_items_taxes`
ADD CONSTRAINT `phppos_items_taxes_ibfk_1` 
FOREIGN KEY (`item_id`) 
REFERENCES `phppos_items` (`item_id`) 
ON DELETE CASCADE;

Does this mean when phppos_items.id is deleted, it will be delete entries on phppos_items_taxes?

I am just have a hard time interpreting it.

Upvotes: 1

Views: 9269

Answers (1)

Milan Jaric
Milan Jaric

Reputation: 5646

yes, but do you really need to physically delete that entry. Sometimes it is better to set some kind of flag in root entity which will tell if it should act as deleted/filtered

Upvotes: 1

Related Questions