4 ms·
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
by chrisshroba 4y ago
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?
- jermaustin1 4y agobecause 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'.
- thehappypm 4y agoAssuming that the joins are always joined against the views, not the raw tables. This introduces an opportunity for a mistake.