Soft Delete
Soft delete is a database design pattern where records are marked as deleted (e.g., with a boolean flag or timestamp) instead of being physically removed from the database. This allows for data recovery, audit trails, and maintaining referential integrity while hiding the records from normal application queries. It's commonly implemented using columns like 'is_deleted', 'deleted_at', or 'status' to indicate deletion state.
Developers should use soft delete when they need to preserve data for compliance, auditing, or recovery purposes, such as in financial systems, user account management, or content platforms where accidental deletions must be reversible. It's also useful in applications requiring historical data analysis or where hard deletes could break foreign key constraints, but it adds complexity to queries and requires careful handling to avoid data leakage.