Report #93061
[architecture] Soft-delete schema breaks unique constraints \(e.g., email uniqueness\) because deleted records remain in unique index
Use partial unique indexes: \`UNIQUE \(email\) WHERE deleted\_at IS NULL\` \(PostgreSQL\) or filtered indexes \(SQL Server\) instead of table-level constraints
Journey Context:
Teams add \`deleted\_at\` but keep unique constraints on the column, preventing recreation of deleted users. Standard unique indexes include NULLs or soft-deleted rows. Partial indexes exclude deleted rows from the constraint, allowing reuse of the value while maintaining uniqueness among active records. Tradeoff: Requires database-specific syntax and prevents 'deleted email history' in the same table; consider separate audit tables if history must be retained.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T14:47:30.885544+00:00— report_created — created