History and Soft Deletion
Decide deliberately whether you need history. Most applications need it somewhere and model it nowhere, then discover the need after the data is gone.
The question: when this value changes, does anyone ever need to know what it was before? A price, an address, a permission, an order status: usually yes. A display name: usually no.
Soft deletion is a trade, not a free win. A deleted_at column keeps the row and marks it gone.
What it buys: recovery, audit, and referential integrity that does not break.
What it costs: every single query must now remember to exclude deleted rows, and the one that forgets is a data leak. Unique constraints stop working as intended, because a deleted row still occupies the name. And 'delete my data' from a user is not satisfied by a flag.
Mark this lesson complete
Signed in, your progress follows you to every device.