Cascade on Delete or use Triggers?

前端 未结 4 940
傲寒
傲寒 2020-12-10 14:03

Im going through a project I have taken over, and on the database side I have noticed that the previous programmers have written a bunch of triggers to delete child records.

4条回答
  •  一生所求
    2020-12-10 14:07

    I would use cascade on delete, but that is only if you definitely want to delete the child if the parent is deleted.

    If you have any conditional logic (I only delete the child if deleted on a Sunday) then use a trigger.

    I would just change it to cascade on delete, on a development system, then run my unit tests and make certain that nothing breaks.

提交回复
热议问题