Soft delete without breaking sign-ups
A SaaS product lets people delete their account.
Three departments disagree about what "delete" means:
- Support must be able to restore an account within 30 days of deletion.
- Finance must keep the account record permanently, because invoices reference it.
- Growth wants a deleted user's email address to become available for a brand new sign-up immediately, not after 30 days.
Design the schema. An email must be unique among active accounts, and deleting an account must never destroy the record.
The contract
1 relationThe tests reference these names. Everything else is yours, and is what is being assessed: extra tables, extra columns, types, constraints, indexes.
users
idemaildeleted_at
Nothing here yet. Run the tests while signed in and every distinct schema you submit is kept, newest first, so an earlier design can be read next to the one you would write now.
This one is for subscribers
The problem above is the whole problem, and nothing is hidden from it. What a subscription adds is the part that tells you whether your answer holds: a real Postgres runs your schema, a battery of hidden tests decides, and a design review reads what you wrote.
Checking your subscription…
