Soft deletion - clean old versions


Do you have a recommended procedure for deleting permanently old entities that have been soft deleted, in order to save database space ?

We do not have this issue yet, but I know we will meet it at some point. The usual problem with soft deletion mechanisms when you try to purge/archive old versions is to keep foreign keys integrity




At the moment, we don’t have generic procedure for clean-up of soft deleted records. It usually depends on your domain model and cannot be done in a generic way. I recommend that you create a custom scheduler that will purge records using your custom business rules and employ knowledge about your specific foreign keys and constraints.

If you meet this problem usually it means that your system is complex and big enough, in this case any generic procedure will perform badly and does not take into account your needs.