I’m trying to think of a way to automatically remove a row from a table, when the last foreign key reference to it, is dropped. – That is I’m looking for a sort of garbage collection.
I’ve been trying different approaches, alike reference counting, however I was thinking if it would be achievable using the on delete and on update actions?
It sounds like you’re on the right path. I would look into cascade. Cascading is pretty powerful so you might also want to look into soft deletes.