D65 · Nobody holds standing write access to a database, and erasing a record is a named function
Accepted · 2026-10-20 · zuki · Closes #147
Decision: Nobody holds standing write access to a v2 database. Production changes only through migrations and zuki's L0 steps; staging only through its rebuild from main and the nightly rehearsal (D11, D36). For looking into staging and the local stack, the backend team gets a read-only database role, reached through the Supabase CLI, with no secret in the repository. Erasing a record for good is never an app action: it is a named database function that zuki or the database owner runs by hand, which writes an audit row first and never cascades. Anything changed by hand in a database is logged with the database user's name (R-AUD-05).
Why: The higher-ups agreed with the proposed answer on #147 (Syamsul Haris, 2026-10-19). D39 left the way to remove a record for good to this question, and the rehearsal's first unattended night (data phase row 10) waits for it.
Consequences:
- Data phase row 10 is unblocked on this side: the nightly job may wipe and rebuild staging (D36); nobody else writes to it.
- The read-only role on staging is made by a TL step written with the nightly job (row 9, #187), because each rebuild must keep it. It reads; it never writes or erases. On the local stack, every developer is already the database owner of a throwaway copy.
- The erasing functions are a Backend Engineer pack before go-live, beside app.anonymize_driver() and the personal-data work (D15, staff testing and cutover row 3): one function per kind of record that may be erased, each refusing when other rows still refer to it, and each writing its audit row before it deletes.
- Production gets the same read-only role only if a later decision asks for it; until then, looking into production is zuki's, by hand.