Skip to content
Wade Womersley

wade.one

wade womersley – york based software engineer

  • Home
  • 2026
  • November
  • 24
  • Soft Delete Still Leaves You With Hard Decisions

Soft Delete Still Leaves You With Hard Decisions

Posted on November 24, 2026 By
Programming

Adding a deleted_at column is the easy part of soft delete. The interesting questions arrive afterwards. Can somebody reuse the deleted record’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.

Uniqueness is a good example. A deleted project may still occupy a name because the database’s ordinary unique rule includes its row. PostgreSQL supports a unique partial index 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.

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.

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.

Share:

  • Share on Facebook (Opens in new window) Facebook
  • Share on X (Opens in new window) X
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Reddit (Opens in new window) Reddit

Related

Comments

comments

Tags: data-modelling postgresql soft-delete

Post navigation

❮ Previous Post: Graceful Shutdown Is Part of a Successful Deployment

You may also like

Programming
How I Decide When an API Needs Versioning
April 16, 2026
Programming
Cloudant’s Rather Awesome dbcopy for re-reducing the output of existing map/reduce data.
June 23, 2013
Programming
I Trust Boring Infrastructure More Than Clever Infrastructure
April 4, 2026
Programming
An API Timeout Does Not Mean the Operation Failed
October 14, 2026
  • AI
  • artificial intelligence
  • Ego-centric
  • Events
  • Films
  • Food
  • Gaming
  • Gym
  • Hardware
  • Holidays
  • News
  • PHP
  • Programming
  • Random Stuff
  • Reviews
  • Science
  • SEO
  • Software
  • Software Engineer
  • Support
  • Uncategorized
  • Work

Copyright © 2026 wade.one.

Theme: Oceanly News Dark by ScriptsTown