Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
blumomo
on Jan 1, 2023
|
parent
|
context
|
favorite
| on:
Easy, alternative soft deletion: `deleted_record_i...
Often other tables have foreign keys to the record to be deleted. What’s a good pattern for treating those related tables for every time a relationship row gets deleted/removed as per the OP blog post?
config_yml
on Jan 1, 2023
[–]
Really depends on the related data, but there‘s the option to use ON DELETE CASCADE|RESTRICT and set null or set default.
Cascade can be a bit of a footgun, as this can trigger a waterfall of deletes.
danparsonson
on Jan 1, 2023
|
parent
[–]
Cascades can also lead to deadlocks as I found to my cost the one and so far only time I tried using hard deletes.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: