I'm so glad that someone has already written a gem for this!
I was looking at your Postgres adapter code, and what do you think of using CREATE CONSTRAINT TRIGGER instead? That is how Postgres implements its own foreign keys, and it would let you do SET CONSTRAINTS on these like you can with regular foreign keys. It would require changing the triggers from BEFORE to AFTER, but that doesn't look like a problem to me.
Incidentally, you should technically have an UPDATE trigger on the same table as the DELETE trigger in case the primary key changes, although I understand that is unlikely to happen in a Rails app.
I'm so glad that someone has already written a gem for this!
I was looking at your Postgres adapter code, and what do you think of using
CREATE CONSTRAINT TRIGGERinstead? That is how Postgres implements its own foreign keys, and it would let you doSET CONSTRAINTSon these like you can with regular foreign keys. It would require changing the triggers fromBEFOREtoAFTER, but that doesn't look like a problem to me.Incidentally, you should technically have an
UPDATEtrigger on the same table as theDELETEtrigger in case the primary key changes, although I understand that is unlikely to happen in a Rails app.