You might think you need soft delete and that is a cool feature. Yes, it is cool feature but there tricky and hard parts of it like:
- Code leakage - you need to remember filter on reverse relationships
- Losing foreign keys - ForeignKey won't be properly cascade deleted and pruning data is hard
- Undelete strategy
So what is the alternative to it then?
1) Do not use soft-delete?? 🤔 Who cares about deleted data? How to restore them - more problems than pros.
2) Maybe integrate Archive functionality ✨ Add interface to use so he can archive items and delete them fully only when that item is not related to users item. Good example here Tagging system on blogpost for example. You can't fully delete tag unless it is not used in BlogPost for example. But you can "hide" it of showing at UI for adding it on BlogPost.
* Soft Deletion Probably Isn't Worth It
* Using database triggers to reliably track model history with Wes Kendall