Hacker News new | ask | show | jobs
by onion2k 1263 days ago
Whenever I've implemented undo (or undelete) there's always been a horrible nagging feeling in my head of "What happens if there's a data breach before something gets hard deleted?" People will expect their deleted data to have been properly deleted. If they discover that it wasn't then regardless of how well I explain how undo features have to work there will always be some users who think I lied about the delete feature.

It also makes things like GDPR and erasing people's data a little harder (although not much).

Hard delete also frees resources immediately, which can save some money at scale.

And, ultimately, most users don't expect it in a web app, so you can save time by not building it.

1 comments

True.

Yet so many ORM's come with "soft-delete" built-in:

- [Golang Bun](https://bun.uptrace.dev/guide/soft-deletes.html#introduction) Lightweight Golang ORM for PostgreSQL, MySQL, MSSQL, and SQLite

- [Golang GORM](https://gorm.io/docs/delete.html#Soft-Delete) The fantastic ORM library for Golang

- [Typescript DeepKit](https://docs.deepkit.io/english/database.html#_plugins) High performance typescript framework

- [Java Spring](https://www.baeldung.com/spring-jpa-soft-delete) How to Implement a Soft Delete with Spring JPA

- [Typescript TypeOrm](https://doug-martin.github.io/nestjs-query/docs/persistence/...) Easy CRUD for GraphQL

- [Typescript Sequalize](https://sequelize.org/docs/v6/core-concepts/paranoid/) Sequelize is a modern TypeScript and Node.js ORM for Oracle, Postgres, MySQL, MariaDB, SQLite and SQL Server, and more.

- [Typescript Prisma](https://www.prisma.io/docs/concepts/components/prisma-client...) Next-generation Node.js and TypeScript ORM

- [Rust](https://docs.rs/diesel-softdelete/latest/diesel_softdelete/) Diesel query builder

- [Python Django](https://github.com/scoursen/django-softdelete) Soft delete for Django ORM, with support for undelete

GDPR is a good point. Also, do people really go back and delete?