Discussion

Ask HN: Best practices – Should I ever actually delete data?

Imagine you're building a simple CRUD web application. Users can create stuff, mess with stuff, delete stuff, etc.

Is it ever a good idea to actually delete something as a response to user-behavior? Lately I've been defaulting to adding an "is_active" attribute/column/property to the data I store. When a user tries to delete something, I just switch that boolean from true to false.

The upside is I never actually delete anything (and can retrieve it if the customer freaks out because they deleted something on accident), the downside is just that as well...growing datasets that are not actually doing any good, except for being able to save-the-day in very rare customer-support contexts. And the downside of having to include "is_active == true" in most queries I send to retrieve data.

How do you guys handle this?

I was thinking of creating worker-scripts to regularly purge the database of non-active data (dump it to a flat file and send it all to Amazon Glacier or something)

2 points MalcolmDiggs 12 years ago 4 comments

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton