New: Cookbooks and AI ExplanationsStep-by-Step recipes to solve problems connected to Roadmaps and Cheat Sheets. Need more details? Use AI buttons for structured and simple explanations with concrete examples throughout the whole platform.Take a look
I need to delete a record but keep it for compliance. Will a naive is_deleted flag come back to bite me later?
What you'll have at the end
A deleted_at column that hides a row from normal queries while a direct query can still find it and its children
You need
A Postgres customers table already live through your migration tool, with email as a plain unique column, and a support_tickets table with a foreign key to it.
Not covered
Cascading a soft delete down to a row's own children automatically; this recipe keeps existing rows and their links intact, never chaining a delete through a whole relationship graph.
Leans on
Checked 18 Aug 2026
Part of the ORM and Database Abstraction Tools cookbook