I have a little probleme using Triggers in MySQL.
Suppose we have 2 tables:
- TableA
- TableB
And 2 Triggers:
- TriggerA: fires when deleting on TableA and updates TableB
- TriggerB: fires when deleting on TableB and deletes in TableA
The problem is that when I delete some rows in TableB, TriggerB fires and deletes some elements in TableA, then TriggerA fires and tries to update TableB.
It fails because TriggerA tries to update some rows in TableB that are being deleted.
How can I avoid this circular dependencies?
None of those two Triggers are useless, so I don't know what am I supposed to do to solve this.