Six Lines of Code to Soft-Delete Postgres Rows and Reclaim That Precious URL Slug
Imagine archiving a blog post, only for the next one with the same title to bomb on insert. One dev's dead-simple fix: rename the slug on archive. No partial indexes, no drama.
theAIcatchupApr 10, 20264 min read
⚡ Key Takeaways
Rename slugs on archive with timestamps to dodge unique constraint fights — six lines, zero schema changes.𝕏
Ditch partial indexes and deleted_at predicates for most blogs; they're overkill maintenance traps.𝕏
Perfect for indie tools like Drippery, where reuse trumps permanence.𝕏
The 60-Second TL;DR
Rename slugs on archive with timestamps to dodge unique constraint fights — six lines, zero schema changes.
Ditch partial indexes and deleted_at predicates for most blogs; they're overkill maintenance traps.
Perfect for indie tools like Drippery, where reuse trumps permanence.