Writing down a couple of thoughts on databases before I (Tobias) forget them;
- Soft deletes are really useful and prevent many a catastrophe. Just a column saying ‘deleted’ that’s checked instead of removing records, and anything user-facing can ignore records flagged as deleted
- Similarly, a column/flag named ‘Junk / Dan’s really important stuff (whichever you prefer)’ can also be useful together with a website mode to check that flag of any record getting added, since you can then mass-delete anything flagged as such in the database without worrying about deleting anything important
- If you like the ideas of soft deletes, they can be taken a step further to preserve any change made to certain tables, not just deletions, by keeping a version history. Instead of changing records, you’d insert a new one, with an incremented version number, representing the updated record. It requires that you move from a single primary key for tables to a pair of (item_id, version_id), which is a bit more work to setup, but i’ve used this in a couple of projects and it’s really nice to have when it’s in place. For instance, the user Rob could exist in 5 versions, all having item_id of 1, but the version_id would be incremented for each of them as 0, 1, 2, 3, 4. User-facing things would just read the highest version of any given item (unless you also want to show the user their change history of projects etc)