Working on a project at the moment and we have to implement soft deletion for the majority of users (user roles). We decided to add an is_deleted='0'
field on each table in the database and set it to '1'
if particular user roles hit a delete button on a specific record.
For future maintenance now, each SELECT
query will need to ensure they do not include records where is_deleted='1'
.
Is there a better solution for implementing soft deletion?
Update: I should also note that we have an Audit database that tracks changes (field, old value, new value, time, user, ip) to all tables/fields within the Application database.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…