a tool for shared writing and social publishing
at main 153 lines 10 kB view raw
1create table "public"."documents" ( 2 "uri" text not null, 3 "data" jsonb not null, 4 "indexed_at" timestamp with time zone not null default now() 5); 6alter table "public"."documents" enable row level security; 7create table "public"."documents_in_publications" ( 8 "publication" text not null, 9 "document" text not null, 10 "indexed_at" timestamp with time zone not null default now() 11); 12alter table "public"."documents_in_publications" enable row level security; 13create table "public"."oauth_session_store" ( 14 "key" text not null, 15 "session" jsonb not null 16); 17alter table "public"."oauth_session_store" enable row level security; 18create table "public"."oauth_state_store" ( 19 "key" text not null, 20 "state" jsonb not null 21); 22alter table "public"."oauth_state_store" enable row level security; 23create table "public"."publications" ( 24 "uri" text not null, 25 "indexed_at" timestamp with time zone not null default now(), 26 "name" text not null, 27 "identity_did" text not null 28); 29alter table "public"."publications" enable row level security; 30alter table "public"."email_auth_tokens" alter column "email" drop not null; 31alter table "public"."identities" add column "atp_did" text; 32CREATE UNIQUE INDEX documents_in_publications_pkey ON public.documents_in_publications USING btree (publication, document); 33CREATE UNIQUE INDEX documents_pkey ON public.documents USING btree (uri); 34CREATE UNIQUE INDEX identities_atp_did_key ON public.identities USING btree (atp_did); 35CREATE UNIQUE INDEX oauth_session_store_pkey ON public.oauth_session_store USING btree (key); 36CREATE UNIQUE INDEX oauth_state_store_pkey ON public.oauth_state_store USING btree (key); 37CREATE UNIQUE INDEX publications_pkey ON public.publications USING btree (uri); 38alter table "public"."documents" add constraint "documents_pkey" PRIMARY KEY using index "documents_pkey"; 39alter table "public"."documents_in_publications" add constraint "documents_in_publications_pkey" PRIMARY KEY using index "documents_in_publications_pkey"; 40alter table "public"."oauth_session_store" add constraint "oauth_session_store_pkey" PRIMARY KEY using index "oauth_session_store_pkey"; 41alter table "public"."oauth_state_store" add constraint "oauth_state_store_pkey" PRIMARY KEY using index "oauth_state_store_pkey"; 42alter table "public"."publications" add constraint "publications_pkey" PRIMARY KEY using index "publications_pkey"; 43alter table "public"."documents_in_publications" add constraint "documents_in_publications_document_fkey" FOREIGN KEY (document) REFERENCES documents(uri) ON DELETE CASCADE not valid; 44alter table "public"."documents_in_publications" validate constraint "documents_in_publications_document_fkey"; 45alter table "public"."documents_in_publications" add constraint "documents_in_publications_publication_fkey" FOREIGN KEY (publication) REFERENCES publications(uri) ON DELETE CASCADE not valid; 46alter table "public"."documents_in_publications" validate constraint "documents_in_publications_publication_fkey"; 47alter table "public"."identities" add constraint "identities_atp_did_key" UNIQUE using index "identities_atp_did_key"; 48grant delete on table "public"."documents" to "anon"; 49grant insert on table "public"."documents" to "anon"; 50grant references on table "public"."documents" to "anon"; 51grant select on table "public"."documents" to "anon"; 52grant trigger on table "public"."documents" to "anon"; 53grant truncate on table "public"."documents" to "anon"; 54grant update on table "public"."documents" to "anon"; 55grant delete on table "public"."documents" to "authenticated"; 56grant insert on table "public"."documents" to "authenticated"; 57grant references on table "public"."documents" to "authenticated"; 58grant select on table "public"."documents" to "authenticated"; 59grant trigger on table "public"."documents" to "authenticated"; 60grant truncate on table "public"."documents" to "authenticated"; 61grant update on table "public"."documents" to "authenticated"; 62grant delete on table "public"."documents" to "service_role"; 63grant insert on table "public"."documents" to "service_role"; 64grant references on table "public"."documents" to "service_role"; 65grant select on table "public"."documents" to "service_role"; 66grant trigger on table "public"."documents" to "service_role"; 67grant truncate on table "public"."documents" to "service_role"; 68grant update on table "public"."documents" to "service_role"; 69grant delete on table "public"."documents_in_publications" to "anon"; 70grant insert on table "public"."documents_in_publications" to "anon"; 71grant references on table "public"."documents_in_publications" to "anon"; 72grant select on table "public"."documents_in_publications" to "anon"; 73grant trigger on table "public"."documents_in_publications" to "anon"; 74grant truncate on table "public"."documents_in_publications" to "anon"; 75grant update on table "public"."documents_in_publications" to "anon"; 76grant delete on table "public"."documents_in_publications" to "authenticated"; 77grant insert on table "public"."documents_in_publications" to "authenticated"; 78grant references on table "public"."documents_in_publications" to "authenticated"; 79grant select on table "public"."documents_in_publications" to "authenticated"; 80grant trigger on table "public"."documents_in_publications" to "authenticated"; 81grant truncate on table "public"."documents_in_publications" to "authenticated"; 82grant update on table "public"."documents_in_publications" to "authenticated"; 83grant delete on table "public"."documents_in_publications" to "service_role"; 84grant insert on table "public"."documents_in_publications" to "service_role"; 85grant references on table "public"."documents_in_publications" to "service_role"; 86grant select on table "public"."documents_in_publications" to "service_role"; 87grant trigger on table "public"."documents_in_publications" to "service_role"; 88grant truncate on table "public"."documents_in_publications" to "service_role"; 89grant update on table "public"."documents_in_publications" to "service_role"; 90grant delete on table "public"."oauth_session_store" to "anon"; 91grant insert on table "public"."oauth_session_store" to "anon"; 92grant references on table "public"."oauth_session_store" to "anon"; 93grant select on table "public"."oauth_session_store" to "anon"; 94grant trigger on table "public"."oauth_session_store" to "anon"; 95grant truncate on table "public"."oauth_session_store" to "anon"; 96grant update on table "public"."oauth_session_store" to "anon"; 97grant delete on table "public"."oauth_session_store" to "authenticated"; 98grant insert on table "public"."oauth_session_store" to "authenticated"; 99grant references on table "public"."oauth_session_store" to "authenticated"; 100grant select on table "public"."oauth_session_store" to "authenticated"; 101grant trigger on table "public"."oauth_session_store" to "authenticated"; 102grant truncate on table "public"."oauth_session_store" to "authenticated"; 103grant update on table "public"."oauth_session_store" to "authenticated"; 104grant delete on table "public"."oauth_session_store" to "service_role"; 105grant insert on table "public"."oauth_session_store" to "service_role"; 106grant references on table "public"."oauth_session_store" to "service_role"; 107grant select on table "public"."oauth_session_store" to "service_role"; 108grant trigger on table "public"."oauth_session_store" to "service_role"; 109grant truncate on table "public"."oauth_session_store" to "service_role"; 110grant update on table "public"."oauth_session_store" to "service_role"; 111grant delete on table "public"."oauth_state_store" to "anon"; 112grant insert on table "public"."oauth_state_store" to "anon"; 113grant references on table "public"."oauth_state_store" to "anon"; 114grant select on table "public"."oauth_state_store" to "anon"; 115grant trigger on table "public"."oauth_state_store" to "anon"; 116grant truncate on table "public"."oauth_state_store" to "anon"; 117grant update on table "public"."oauth_state_store" to "anon"; 118grant delete on table "public"."oauth_state_store" to "authenticated"; 119grant insert on table "public"."oauth_state_store" to "authenticated"; 120grant references on table "public"."oauth_state_store" to "authenticated"; 121grant select on table "public"."oauth_state_store" to "authenticated"; 122grant trigger on table "public"."oauth_state_store" to "authenticated"; 123grant truncate on table "public"."oauth_state_store" to "authenticated"; 124grant update on table "public"."oauth_state_store" to "authenticated"; 125grant delete on table "public"."oauth_state_store" to "service_role"; 126grant insert on table "public"."oauth_state_store" to "service_role"; 127grant references on table "public"."oauth_state_store" to "service_role"; 128grant select on table "public"."oauth_state_store" to "service_role"; 129grant trigger on table "public"."oauth_state_store" to "service_role"; 130grant truncate on table "public"."oauth_state_store" to "service_role"; 131grant update on table "public"."oauth_state_store" to "service_role"; 132grant delete on table "public"."publications" to "anon"; 133grant insert on table "public"."publications" to "anon"; 134grant references on table "public"."publications" to "anon"; 135grant select on table "public"."publications" to "anon"; 136grant trigger on table "public"."publications" to "anon"; 137grant truncate on table "public"."publications" to "anon"; 138grant update on table "public"."publications" to "anon"; 139grant delete on table "public"."publications" to "authenticated"; 140grant insert on table "public"."publications" to "authenticated"; 141grant references on table "public"."publications" to "authenticated"; 142grant select on table "public"."publications" to "authenticated"; 143grant trigger on table "public"."publications" to "authenticated"; 144grant truncate on table "public"."publications" to "authenticated"; 145grant update on table "public"."publications" to "authenticated"; 146grant delete on table "public"."publications" to "service_role"; 147grant insert on table "public"."publications" to "service_role"; 148grant references on table "public"."publications" to "service_role"; 149grant select on table "public"."publications" to "service_role"; 150grant trigger on table "public"."publications" to "service_role"; 151grant truncate on table "public"."publications" to "service_role"; 152grant update on table "public"."publications" to "service_role"; 153create schema if not exists "publications";