Re:Soft deletion probably isn't worth it
by chrisshroba on Tuesday July 19, 2022 @03:33PM
(#32156797)
How would a view solve the foreign key issue? Are you suggesting coding specific deletion triggers into the view such that appropriate foreign keys are "cascade" deleted when a row in the view is deleted?
[ Parent
| on HN ]
Re:Soft deletion probably isn't worth it
by jermaustin1 on Tuesday July 19, 2022 @03:52PM
(#32157041)
because when you are getting a child record through a join (in the view), the parent will never have deleted_at set.
Say I have a simple view `select * from foo join bar on foo.foo_id = bar.foo_id where foo.deleted_at is null`
I never have to worry about deleting from bar, because I should never grab a child when the parent is 'deleted'.
Re:Soft deletion probably isn't worth it
by thehappypm on Tuesday July 19, 2022 @04:39PM
(#32157654)
Assuming that the joins are always joined against the views, not the raw tables. This introduces an opportunity for a mistake.