a tool for shared writing and social publishing
at feature/footnotes 124 lines 5.0 kB view raw
1create type "public"."rsvp_status" as enum ('GOING', 'NOT_GOING', 'MAYBE'); 2 3create table "public"."phone_number_auth_tokens" ( 4 "id" uuid not null default gen_random_uuid(), 5 "created_at" timestamp with time zone not null default now(), 6 "confirmed" boolean not null default false, 7 "confirmation_code" text not null, 8 "phone_number" text not null, 9 "country_code" text not null 10); 11 12 13alter table "public"."phone_number_auth_tokens" enable row level security; 14 15create table "public"."phone_rsvps_to_entity" ( 16 "created_at" timestamp with time zone not null default now(), 17 "phone_number" text not null, 18 "country_code" text not null, 19 "status" rsvp_status not null, 20 "id" uuid not null default gen_random_uuid(), 21 "entity" uuid not null, 22 "name" text not null default ''::text 23); 24 25 26alter table "public"."phone_rsvps_to_entity" enable row level security; 27 28CREATE UNIQUE INDEX phone_number_auth_tokens_pkey ON public.phone_number_auth_tokens USING btree (id); 29 30CREATE UNIQUE INDEX phone_rsvps_to_entity_pkey ON public.phone_rsvps_to_entity USING btree (id); 31 32CREATE UNIQUE INDEX unique_phone_number_entities ON public.phone_rsvps_to_entity USING btree (phone_number, entity); 33 34alter table "public"."phone_number_auth_tokens" add constraint "phone_number_auth_tokens_pkey" PRIMARY KEY using index "phone_number_auth_tokens_pkey"; 35 36alter table "public"."phone_rsvps_to_entity" add constraint "phone_rsvps_to_entity_pkey" PRIMARY KEY using index "phone_rsvps_to_entity_pkey"; 37 38alter table "public"."phone_rsvps_to_entity" add constraint "phone_rsvps_to_entity_entity_fkey" FOREIGN KEY (entity) REFERENCES entities(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; 39 40alter table "public"."phone_rsvps_to_entity" validate constraint "phone_rsvps_to_entity_entity_fkey"; 41 42grant delete on table "public"."phone_number_auth_tokens" to "anon"; 43 44grant insert on table "public"."phone_number_auth_tokens" to "anon"; 45 46grant references on table "public"."phone_number_auth_tokens" to "anon"; 47 48grant select on table "public"."phone_number_auth_tokens" to "anon"; 49 50grant trigger on table "public"."phone_number_auth_tokens" to "anon"; 51 52grant truncate on table "public"."phone_number_auth_tokens" to "anon"; 53 54grant update on table "public"."phone_number_auth_tokens" to "anon"; 55 56grant delete on table "public"."phone_number_auth_tokens" to "authenticated"; 57 58grant insert on table "public"."phone_number_auth_tokens" to "authenticated"; 59 60grant references on table "public"."phone_number_auth_tokens" to "authenticated"; 61 62grant select on table "public"."phone_number_auth_tokens" to "authenticated"; 63 64grant trigger on table "public"."phone_number_auth_tokens" to "authenticated"; 65 66grant truncate on table "public"."phone_number_auth_tokens" to "authenticated"; 67 68grant update on table "public"."phone_number_auth_tokens" to "authenticated"; 69 70grant delete on table "public"."phone_number_auth_tokens" to "service_role"; 71 72grant insert on table "public"."phone_number_auth_tokens" to "service_role"; 73 74grant references on table "public"."phone_number_auth_tokens" to "service_role"; 75 76grant select on table "public"."phone_number_auth_tokens" to "service_role"; 77 78grant trigger on table "public"."phone_number_auth_tokens" to "service_role"; 79 80grant truncate on table "public"."phone_number_auth_tokens" to "service_role"; 81 82grant update on table "public"."phone_number_auth_tokens" to "service_role"; 83 84grant delete on table "public"."phone_rsvps_to_entity" to "anon"; 85 86grant insert on table "public"."phone_rsvps_to_entity" to "anon"; 87 88grant references on table "public"."phone_rsvps_to_entity" to "anon"; 89 90grant select on table "public"."phone_rsvps_to_entity" to "anon"; 91 92grant trigger on table "public"."phone_rsvps_to_entity" to "anon"; 93 94grant truncate on table "public"."phone_rsvps_to_entity" to "anon"; 95 96grant update on table "public"."phone_rsvps_to_entity" to "anon"; 97 98grant delete on table "public"."phone_rsvps_to_entity" to "authenticated"; 99 100grant insert on table "public"."phone_rsvps_to_entity" to "authenticated"; 101 102grant references on table "public"."phone_rsvps_to_entity" to "authenticated"; 103 104grant select on table "public"."phone_rsvps_to_entity" to "authenticated"; 105 106grant trigger on table "public"."phone_rsvps_to_entity" to "authenticated"; 107 108grant truncate on table "public"."phone_rsvps_to_entity" to "authenticated"; 109 110grant update on table "public"."phone_rsvps_to_entity" to "authenticated"; 111 112grant delete on table "public"."phone_rsvps_to_entity" to "service_role"; 113 114grant insert on table "public"."phone_rsvps_to_entity" to "service_role"; 115 116grant references on table "public"."phone_rsvps_to_entity" to "service_role"; 117 118grant select on table "public"."phone_rsvps_to_entity" to "service_role"; 119 120grant trigger on table "public"."phone_rsvps_to_entity" to "service_role"; 121 122grant truncate on table "public"."phone_rsvps_to_entity" to "service_role"; 123 124grant update on table "public"."phone_rsvps_to_entity" to "service_role";