Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you want to delete something, delete it.

If you want to restore something, get it from a backup.

If you want to delete something, but you fear that it will ruin something in your db because the architecture is a mess and you are not really sure what references what and what will break, then soft-delete it.

But what is the point of this?



soft deletes clutter up the table in question. They lead to bugs in code when people forget to exclude the soft deletes WHERE clause. It also can complicates patterns: user deletes account, a month later the same user wants to create a new account but the soft delete row prevents creation due to duplicate email address.

This seems like a clever solution that simply deletes rows but provides a cumbersome mechanism to see history of delete data if they need it.


Not too terribly cumbersome when you have jsonb_populate_record in Postgres.

https://www.postgresql.org/docs/current/functions-json.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: