Soft delete gotchas

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the databases category.

Last Updated: 2024-03-27

Soft delete removes delete cascades

Someone added soft delete to all models in a code base, then we started getting incorrect data everywhere. This was ultimately because related records were kept around after deletion of their parent, which was a regression because we used DB cascades in the past to ensure these were correctly deleted since these records made no sense on their own.