Remix.run Logo
orionblastar 2 days ago

Most databases I used have a Status column we could mark as active, inactive, or deleted. That way, you can see what records were marked as deleted and change them back in case of accidental deletion.

Keep record retention with the Date_Modified column so you can use SQL delete to remove those deleted records that are older than a year or so.

arielcostas 2 days ago | parent [-]

I do something similar, but instead keep a "date_deleted" column null by default, and the "active" column as a boolean.

That way, I kill two birds in one stone by having a dedicated column for last deletion (instead of updating a record that is supposedly deleted) and the status just as a boolean instead of some enum, or integer or string.