{"id":1516,"date":"2026-11-24T18:00:00","date_gmt":"2026-11-24T18:00:00","guid":{"rendered":"https:\/\/wade.one\/blog\/?p=1516"},"modified":"2026-11-24T18:00:00","modified_gmt":"2026-11-24T18:00:00","slug":"soft-delete-still-leaves-you-with-hard-decisions","status":"publish","type":"post","link":"https:\/\/wade.one\/blog\/2026\/11\/24\/soft-delete-still-leaves-you-with-hard-decisions\/","title":{"rendered":"Soft Delete Still Leaves You With Hard Decisions"},"content":{"rendered":"<p>Adding a <code>deleted_at<\/code> column is the easy part of soft delete. The interesting questions arrive afterwards. Can somebody reuse the deleted record&#8217;s name? What happens when you restore it? Should its children disappear from normal views too? Keeping the row gives you options, but the application still needs to choose what those options mean.<\/p>\n<p>Uniqueness is a good example. A deleted project may still occupy a name because the database&#8217;s ordinary unique rule includes its row. PostgreSQL supports a <a href=\"https:\/\/www.postgresql.org\/docs\/18\/ddl-constraints.html#DDL-CONSTRAINTS-UNIQUE-CONSTRAINTS\">unique partial index<\/a> when uniqueness should cover only a subset of rows. That can express a rule such as unique names among active projects in the same account. It also means restoring an older project may conflict with a name somebody has since reused. The restore flow needs an answer for that.<\/p>\n<p>Relationships need similar care. Setting a timestamp does not remove the parent row, so a foreign key can remain perfectly satisfied while the product considers the parent deleted. Decide whether related records stay visible, become hidden or need their own transition. Apply that decision to search, exports and background jobs as well as the main list screen. A default filter helps only along the code paths that actually use it.<\/p>\n<p>I would test the lifecycle: create, delete, reuse the name, attempt restoration and inspect the related records. Be clear in the interface about what can be recovered and what happens to it meanwhile. If the requirement is genuinely to remove stored data, setting a timestamp does not meet it. Soft delete can be useful for undo and recovery, but it introduces a persistent state that every relevant reader and writer has to understand. That is the part I would estimate before calling it a small feature.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Adding deleted_at keeps the row. It does not decide how uniqueness, restoration or related records should behave.<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[13],"tags":[343,253,342],"class_list":["post-1516","post","type-post","status-publish","format-standard","hentry","category-programming","tag-data-modelling","tag-postgresql","tag-soft-delete"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Soft Delete Still Leaves You With Hard Decisions - wade.one<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wade.one\/blog\/2026\/11\/24\/soft-delete-still-leaves-you-with-hard-decisions\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Soft Delete Still Leaves You With Hard Decisions - wade.one\" \/>\n<meta property=\"og:description\" content=\"Adding deleted_at keeps the row. It does not decide how uniqueness, restoration or related records should behave.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wade.one\/blog\/2026\/11\/24\/soft-delete-still-leaves-you-with-hard-decisions\/\" \/>\n<meta property=\"og:site_name\" content=\"wade.one\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-24T18:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/Wade-Logo-cropped.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1518\" \/>\n\t<meta property=\"og:image:height\" content=\"1506\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@wadewomersley\" \/>\n<meta name=\"twitter:site\" content=\"@wadewomersley\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/11\\\/24\\\/soft-delete-still-leaves-you-with-hard-decisions\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/11\\\/24\\\/soft-delete-still-leaves-you-with-hard-decisions\\\/\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"Soft Delete Still Leaves You With Hard Decisions\",\"datePublished\":\"2026-11-24T18:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/11\\\/24\\\/soft-delete-still-leaves-you-with-hard-decisions\\\/\"},\"wordCount\":296,\"publisher\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/#\\\/schema\\\/person\\\/8b4739f8f8bb2cff5d792d4b8779fcc3\"},\"keywords\":[\"data-modelling\",\"postgresql\",\"soft-delete\"],\"articleSection\":[\"Programming\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/11\\\/24\\\/soft-delete-still-leaves-you-with-hard-decisions\\\/\",\"url\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/11\\\/24\\\/soft-delete-still-leaves-you-with-hard-decisions\\\/\",\"name\":\"Soft Delete Still Leaves You With Hard Decisions - wade.one\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/#website\"},\"datePublished\":\"2026-11-24T18:00:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/11\\\/24\\\/soft-delete-still-leaves-you-with-hard-decisions\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/11\\\/24\\\/soft-delete-still-leaves-you-with-hard-decisions\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/11\\\/24\\\/soft-delete-still-leaves-you-with-hard-decisions\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wade.one\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Soft Delete Still Leaves You With Hard Decisions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/wade.one\\\/blog\\\/\",\"name\":\"wade.one\",\"description\":\"wade womersley - york based software engineer\",\"publisher\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/#\\\/schema\\\/person\\\/8b4739f8f8bb2cff5d792d4b8779fcc3\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wade.one\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/#\\\/schema\\\/person\\\/8b4739f8f8bb2cff5d792d4b8779fcc3\",\"name\":\"Wade Womersley\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/02\\\/200px.png\",\"url\":\"https:\\\/\\\/wade.one\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/02\\\/200px.png\",\"contentUrl\":\"https:\\\/\\\/wade.one\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/02\\\/200px.png\",\"width\":202,\"height\":200,\"caption\":\"Wade Womersley\"},\"logo\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/02\\\/200px.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Soft Delete Still Leaves You With Hard Decisions - wade.one","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wade.one\/blog\/2026\/11\/24\/soft-delete-still-leaves-you-with-hard-decisions\/","og_locale":"en_GB","og_type":"article","og_title":"Soft Delete Still Leaves You With Hard Decisions - wade.one","og_description":"Adding deleted_at keeps the row. It does not decide how uniqueness, restoration or related records should behave.","og_url":"https:\/\/wade.one\/blog\/2026\/11\/24\/soft-delete-still-leaves-you-with-hard-decisions\/","og_site_name":"wade.one","article_published_time":"2026-11-24T18:00:00+00:00","og_image":[{"width":1518,"height":1506,"url":"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/Wade-Logo-cropped.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_creator":"@wadewomersley","twitter_site":"@wadewomersley","twitter_misc":{"Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wade.one\/blog\/2026\/11\/24\/soft-delete-still-leaves-you-with-hard-decisions\/#article","isPartOf":{"@id":"https:\/\/wade.one\/blog\/2026\/11\/24\/soft-delete-still-leaves-you-with-hard-decisions\/"},"author":{"name":"","@id":""},"headline":"Soft Delete Still Leaves You With Hard Decisions","datePublished":"2026-11-24T18:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/wade.one\/blog\/2026\/11\/24\/soft-delete-still-leaves-you-with-hard-decisions\/"},"wordCount":296,"publisher":{"@id":"https:\/\/wade.one\/blog\/#\/schema\/person\/8b4739f8f8bb2cff5d792d4b8779fcc3"},"keywords":["data-modelling","postgresql","soft-delete"],"articleSection":["Programming"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/wade.one\/blog\/2026\/11\/24\/soft-delete-still-leaves-you-with-hard-decisions\/","url":"https:\/\/wade.one\/blog\/2026\/11\/24\/soft-delete-still-leaves-you-with-hard-decisions\/","name":"Soft Delete Still Leaves You With Hard Decisions - wade.one","isPartOf":{"@id":"https:\/\/wade.one\/blog\/#website"},"datePublished":"2026-11-24T18:00:00+00:00","breadcrumb":{"@id":"https:\/\/wade.one\/blog\/2026\/11\/24\/soft-delete-still-leaves-you-with-hard-decisions\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wade.one\/blog\/2026\/11\/24\/soft-delete-still-leaves-you-with-hard-decisions\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wade.one\/blog\/2026\/11\/24\/soft-delete-still-leaves-you-with-hard-decisions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wade.one\/blog\/"},{"@type":"ListItem","position":2,"name":"Soft Delete Still Leaves You With Hard Decisions"}]},{"@type":"WebSite","@id":"https:\/\/wade.one\/blog\/#website","url":"https:\/\/wade.one\/blog\/","name":"wade.one","description":"wade womersley - york based software engineer","publisher":{"@id":"https:\/\/wade.one\/blog\/#\/schema\/person\/8b4739f8f8bb2cff5d792d4b8779fcc3"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wade.one\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/wade.one\/blog\/#\/schema\/person\/8b4739f8f8bb2cff5d792d4b8779fcc3","name":"Wade Womersley","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/200px.png","url":"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/200px.png","contentUrl":"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/200px.png","width":202,"height":200,"caption":"Wade Womersley"},"logo":{"@id":"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/200px.png"}}]}},"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1472,"url":"https:\/\/wade.one\/blog\/2026\/10\/29\/a-database-constraint-can-close-the-gap-between-checking-and-writing\/","url_meta":{"origin":1516,"position":0},"title":"A Database Constraint Can Close the Gap Between Checking and Writing","author":"","date":"October 29, 2026","format":false,"excerpt":"Checking whether a record exists before inserting another one does not guarantee uniqueness.","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/wade.one\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1431,"url":"https:\/\/wade.one\/blog\/2026\/10\/12\/postgresql-14-support-ends-in-november-plan-the-upgrade-now\/","url_meta":{"origin":1516,"position":1},"title":"PostgreSQL 14 Support Ends in November: Plan the Upgrade Now","author":"","date":"October 12, 2026","format":false,"excerpt":"PostgreSQL 14 reaches the end of community support on 12 November 2026.","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/wade.one\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1498,"url":"https:\/\/wade.one\/blog\/2026\/11\/14\/a-backup-is-more-convincing-after-you-have-restored-it\/","url_meta":{"origin":1516,"position":2},"title":"A Backup Is More Convincing After You Have Restored It","author":"","date":"November 14, 2026","format":false,"excerpt":"A successful backup job tells you something useful. Restoring it and running the application tells you considerably more.","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/wade.one\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1503,"url":"https:\/\/wade.one\/blog\/2026\/11\/13\/optimistic-locking-stops-an-old-tab-overwriting-new-work\/","url_meta":{"origin":1516,"position":3},"title":"Optimistic Locking Stops an Old Tab Overwriting New Work","author":"","date":"November 13, 2026","format":false,"excerpt":"Two people can save valid changes and still overwrite each other. A version check gives the application a chance to catch it.","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/wade.one\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1434,"url":"https:\/\/wade.one\/blog\/2026\/10\/15\/read-the-postgresql-query-plan-before-adding-another-index\/","url_meta":{"origin":1516,"position":4},"title":"Read the PostgreSQL Query Plan Before Adding Another Index","author":"","date":"October 15, 2026","format":false,"excerpt":"When a database query gets slow, adding an index is an appealingly concrete thing to do.","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/wade.one\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1512,"url":"https:\/\/wade.one\/blog\/2026\/11\/20\/database-connection-pools-need-a-budget-across-every-instance\/","url_meta":{"origin":1516,"position":5},"title":"Database Connection Pools Need a Budget Across Every Instance","author":"","date":"November 20, 2026","format":false,"excerpt":"A pool of ten connections sounds small until twenty application instances each have one.","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/wade.one\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/posts\/1516","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/comments?post=1516"}],"version-history":[{"count":1,"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/posts\/1516\/revisions"}],"predecessor-version":[{"id":1531,"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/posts\/1516\/revisions\/1531"}],"wp:attachment":[{"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/media?parent=1516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/categories?post=1516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/tags?post=1516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}