0024_signup_allowlist.sql20 lines · main
| 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 | |
| 8 | CREATE TABLE IF NOT EXISTS "signup_allowlist" ( |
| 9 | "id" text PRIMARY KEY NOT NULL, |
| 10 | "email" text NOT NULL, |
| 11 | "invited_by" text, |
| 12 | "invited_at" timestamp with time zone DEFAULT now() NOT NULL, |
| 13 | "accepted_at" timestamp with time zone, |
| 14 | "notes" text, |
| 15 | CONSTRAINT "signup_allowlist_invited_by_fk" |
| 16 | FOREIGN KEY ("invited_by") REFERENCES "users"("id") ON DELETE SET NULL |
| 17 | ); |
| 18 | |
| 19 | CREATE UNIQUE INDEX IF NOT EXISTS "signup_allowlist_email_idx" |
| 20 | ON "signup_allowlist" USING btree ("email"); |