Design a Postgres data model. Optimize for clarity and correctness first, performance second, cleverness never.
Feature: {{what's being built}}
Existing schema: {{paste relevant tables, or "greenfield"}}
Read/write patterns: {{what queries run, how often, hot paths}}
Specific queries expected: {{paste 3-5 queries}}
Produce:
1. **Tables** — columns with types, nullability, defaults, one-line purpose. snake_case, plural tables, singular columns. Include created_at/updated_at where it earns its place.
2. **Relationships** — foreign keys with on-delete behavior chosen explicitly (cascade / restrict / set null), each with a reason.
3. **Constraints** — unique, check, partial indexes. Things enforced at DB rather than app level.
4. **Indexes** — only ones justified by the read patterns above. For each, name the query it serves.
5. **Denormalization decisions** — where normal form was broken, and why the read pattern justifies it.
6. **Migration plan** (if not greenfield) — order of operations, what's reversible, what locks tables, what to do for existing rows.
7. **Smell check** — three questions to answer before committing. Examples: "What happens when X is deleted?" "How does this handle Y at 100x volume?" "Is this row-level or tenant-level?"
If a Supabase-specific consideration applies (RLS, realtime, auth.users join), call it out.databaseschemapostgres