Soft Deletion Will Complicate Your Application
Here are the workarounds and an alternative
The data generated by a software application is valuable. This is also true for data that can be deleted from the application. Keeping deleted data around can help in tracking data history, trends, and relationships between data. On top of that, some parts of the application might be able to make use of deleted historical data.
As a result, a lot of software applications are designed in such a way that data is never actually deleted. One of the popular approaches for accomplishing this is Soft Deletion. Even though this approach looks simple, it often leads to complications. Here, we will look at what makes Soft Deletion complicated. We will also look at an alternative approach to Soft Deletion and it’s own pros and cons.
Supporting Soft Deletion
To support Soft Deletion, we simply add a new field to the schema. A record is flagged as deleted depending on the value of this field. For example, we might have the following schema for the users
table:
id: string
username: string
password: string
created_date: Date
deleted: boolean
In the above example, any user who has the deleted
field set to true
is considered as deleted.