I had a case in my service on those days when it was not possible to delete a record because it was referenced by the log
table. Of course, that has generated a call for IT to solve.
But such a case made me think. Although by default I avoid deleting records, generally inactive the record, in which case I need to delete a record. So in this case I need to delete the records in the log.
Or rather, is there a way I can check FK only when I insert or update the table records?