Data Arch patterns for soft deletions

We’ve been wondering what’s the best way to do handle objects that we ‘soft delete’, as in we don’t remove from the database, but we retain them in the system for an amount of time.

One idea was to extend the BeanMetadata to a soft deletion version of it (i.e., TypeA → TypeA_SoftDeleted) and when something is deleted, convert it to the Soft Delete version of the BM and then account for that type any time we query for current + soft deleted data objects.

Another would be to have a field on the Data Object to track whether if it’s active or not, but that does require anyone making DOQ’s to take that field in consideration.

Thoughts on this?

I think you’ve already received direct replies outside of Discourse but I’ll throw my opinion in here for posterity. Both options are good but have different strengths. It’s up to your project to decide which strength is better.

One other option is to go ahead and delete the data but use a Historical service to track deleted data.

A variation on your second option would be to add a field to track “active” state but use a DataObject Auth Policy to automatically filter out active=false. This option might be best if you can separate who can see inactive data by roles.

Chris