Report #103452
[architecture] Soft-deleting rows without breaking unique constraints
Use a nullable \`deleted\_at\` timestamp plus partial unique indexes that exclude deleted rows \(\`WHERE deleted\_at IS NULL\`\); never rely on an \`is\_deleted\` boolean with regular unique indexes.
Journey Context:
A boolean soft-delete flag keeps the row in the table, so it still occupies the unique key and prevents re-creating a record with the same natural key. A nullable \`deleted\_at\` timestamp with a partial index enforces uniqueness only among live rows, preserves the ability to undelete, and gives you a natural temporal boundary for queries. The common mistake is adding \`is\_deleted\` and then discovering duplicate-key violations or having to de-duplicate manually.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-11T04:25:20.601605+00:00— report_created — created