0024_signup_allowlist.sql 893 B

1234567891011121314151617181920
  1. -- 0024_signup_allowlist — invite-only beta gate.
  2. -- When BRIVEN_OPEN_SIGNUPS=false (the private-beta default), Better
  3. -- Auth's user.create hook rejects any email not in this table. An admin
  4. -- adds entries via /dashboard/admin/allowlist. accepted_at is stamped
  5. -- by the same hook the moment the email signs in for the first time,
  6. -- so the admin sees who's claimed their invite vs who's still pending.
  7. CREATE TABLE IF NOT EXISTS "signup_allowlist" (
  8. "id" text PRIMARY KEY NOT NULL,
  9. "email" text NOT NULL,
  10. "invited_by" text,
  11. "invited_at" timestamp with time zone DEFAULT now() NOT NULL,
  12. "accepted_at" timestamp with time zone,
  13. "notes" text,
  14. CONSTRAINT "signup_allowlist_invited_by_fk"
  15. FOREIGN KEY ("invited_by") REFERENCES "users"("id") ON DELETE SET NULL
  16. );
  17. CREATE UNIQUE INDEX IF NOT EXISTS "signup_allowlist_email_idx"
  18. ON "signup_allowlist" USING btree ("email");