3 ms·
Do any databases let you refer to constant values in foreign keys? Then you could do FOREIGN KEY (foreign_id, NULL) REFERENCES foreign_table(id, deleted_at)
by llimos 4y ago
Do any databases let you refer to constant values in foreign keys?
Then you could do
FOREIGN KEY (foreign_id, NULL) REFERENCES foreign_table(id, deleted_at)
- munk-a 4y agoI don't believe that's possible in postgres at least - but I don't think it's a huge concern either - you can have deleted_at cascade via trigger or just use views to hide the data - both are extremely easy to implement at the DB level without the application devs ever needing to worry about what's what.