fragJulia
Changelog

2026-11-22 — Consent migration applied to the live database

20261121_user_consents.sql is live. Existing accounts are locked until their owners confirm the consents in the app. Verified before and after in rolled-back transactions.

Follows consent records validated on the server. #715 stays open for the legal review.

Order of events (UTC, 2026-11-21)

  1. #719 merged; production deployment dpl_6WBJyLALGhzbLxcLWbCbBwbsZMS5 ready 22:36. /api/studies/health answered from a server function, no error-level runtime logs.
  2. Migration applied to project oxixxrzdrryfztfxlady as 20261121_user_consents. The SQL sent is the repo file without its comments.

State after applying

  • consent_versions: 4 current versions. user_consents: 0 rows. 34 consent_required_* policies on 17 tables.
  • handle_new_user() contains the consent step.
  • Rights: anon cannot execute has_valid_consents(); authenticated can execute has_valid_consents() and grant_consents(), cannot execute record_consents(), cannot insert into user_consents.
  • 4 accounts exist. None has consent records, so all four are locked: they can sign in, read, export and delete, and are asked to confirm in the gate before anything new can be saved.

Verification on the live database (transaction rolled back)

  • Signup with the full set: 4 records, server year, despite a client-sent time of 2000-01-01.
  • Signup with a partial set containing false: rejected (22023), nothing created.
  • Signup without consents: account created, 0 records.
  • Existing account: has_valid_consents() false; insert into chat_sessions refused (42501); own profile readable; after grant_consents() true and the insert works.
  • The inserts into auth.users ran as postgres, not as the Supabase Auth role.

Not verified

  • A real signup and e-mail confirmation through Supabase Auth.
  • The gate on the live site with a real login.

Open

  • Legal review of the wording (health_data is registered as 2026-11-draft); DPIA.
  • Mobile consent screens have not been run on a device.

On this page