I can't remove one of these relationships or change the ON DELETE CASCADE
constraints.
My questions are:
- In the Category table, How do I delete one parent row (a row that has children and its children as well) ?
- In the Product table, How to allow it to delete a product referencing a parent category?
I have tried an Instead Of DELETE trigger but I get an error saying that I cannot define an instead of trigger for a table having on delete cascade constraint. here is my schema...
EDITS:
when I delete a Owner that has categories, the Owner is deleted and his categories (If none of this category has no subcategories.)
If the Category has children, the deletion of Owner fails because of the reference constraint
If the Category has no children, the deletion succeeds.
Finally I found that when I try to delete a Category that has children, I get an error of the due to the ON DELETE NOT ACTION
of a basic self referencing table.