a tool for shared writing and social publishing
0

Configure Feed

Select the types of activity you want to include in your feed.

add publication contributor tables

+91
+91
supabase/migrations/20260525000000_add_publication_contributors.sql
··· 1 + -- publication_contributors: who has been invited / accepted as a contributor to a publication 2 + create table "public"."publication_contributors" ( 3 + "publication_uri" text not null, 4 + "contributor_did" text not null, 5 + "confirmed" boolean not null default false, 6 + "created_at" timestamp with time zone not null default now() 7 + ); 8 + 9 + alter table "public"."publication_contributors" enable row level security; 10 + 11 + CREATE UNIQUE INDEX publication_contributors_pkey ON public.publication_contributors USING btree (publication_uri, contributor_did); 12 + 13 + alter table "public"."publication_contributors" add constraint "publication_contributors_pkey" PRIMARY KEY using index "publication_contributors_pkey"; 14 + 15 + CREATE INDEX publication_contributors_contributor_did_idx ON public.publication_contributors USING btree (contributor_did); 16 + 17 + alter table "public"."publication_contributors" add constraint "publication_contributors_publication_uri_fkey" FOREIGN KEY (publication_uri) REFERENCES publications(uri) ON DELETE CASCADE not valid; 18 + alter table "public"."publication_contributors" validate constraint "publication_contributors_publication_uri_fkey"; 19 + 20 + alter table "public"."publication_contributors" add constraint "publication_contributors_contributor_did_fkey" FOREIGN KEY (contributor_did) REFERENCES identities(atp_did) ON UPDATE CASCADE ON DELETE CASCADE not valid; 21 + alter table "public"."publication_contributors" validate constraint "publication_contributors_contributor_did_fkey"; 22 + 23 + grant delete on table "public"."publication_contributors" to "anon"; 24 + grant insert on table "public"."publication_contributors" to "anon"; 25 + grant references on table "public"."publication_contributors" to "anon"; 26 + grant select on table "public"."publication_contributors" to "anon"; 27 + grant trigger on table "public"."publication_contributors" to "anon"; 28 + grant truncate on table "public"."publication_contributors" to "anon"; 29 + grant update on table "public"."publication_contributors" to "anon"; 30 + 31 + grant delete on table "public"."publication_contributors" to "authenticated"; 32 + grant insert on table "public"."publication_contributors" to "authenticated"; 33 + grant references on table "public"."publication_contributors" to "authenticated"; 34 + grant select on table "public"."publication_contributors" to "authenticated"; 35 + grant trigger on table "public"."publication_contributors" to "authenticated"; 36 + grant truncate on table "public"."publication_contributors" to "authenticated"; 37 + grant update on table "public"."publication_contributors" to "authenticated"; 38 + 39 + grant delete on table "public"."publication_contributors" to "service_role"; 40 + grant insert on table "public"."publication_contributors" to "service_role"; 41 + grant references on table "public"."publication_contributors" to "service_role"; 42 + grant select on table "public"."publication_contributors" to "service_role"; 43 + grant trigger on table "public"."publication_contributors" to "service_role"; 44 + grant truncate on table "public"."publication_contributors" to "service_role"; 45 + grant update on table "public"."publication_contributors" to "service_role"; 46 + 47 + -- leaflet_contributors: who is a contributor on a specific draft. 48 + -- Each draft belongs to one publication, so we reference the draft (permission_token id) directly. 49 + create table "public"."leaflet_contributors" ( 50 + "leaflet" uuid not null, 51 + "contributor_did" text not null, 52 + "created_at" timestamp with time zone not null default now() 53 + ); 54 + 55 + alter table "public"."leaflet_contributors" enable row level security; 56 + 57 + CREATE UNIQUE INDEX leaflet_contributors_pkey ON public.leaflet_contributors USING btree (leaflet, contributor_did); 58 + 59 + alter table "public"."leaflet_contributors" add constraint "leaflet_contributors_pkey" PRIMARY KEY using index "leaflet_contributors_pkey"; 60 + 61 + CREATE INDEX leaflet_contributors_contributor_did_idx ON public.leaflet_contributors USING btree (contributor_did); 62 + 63 + alter table "public"."leaflet_contributors" add constraint "leaflet_contributors_leaflet_fkey" FOREIGN KEY (leaflet) REFERENCES permission_tokens(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; 64 + alter table "public"."leaflet_contributors" validate constraint "leaflet_contributors_leaflet_fkey"; 65 + 66 + alter table "public"."leaflet_contributors" add constraint "leaflet_contributors_contributor_did_fkey" FOREIGN KEY (contributor_did) REFERENCES identities(atp_did) ON UPDATE CASCADE ON DELETE CASCADE not valid; 67 + alter table "public"."leaflet_contributors" validate constraint "leaflet_contributors_contributor_did_fkey"; 68 + 69 + grant delete on table "public"."leaflet_contributors" to "anon"; 70 + grant insert on table "public"."leaflet_contributors" to "anon"; 71 + grant references on table "public"."leaflet_contributors" to "anon"; 72 + grant select on table "public"."leaflet_contributors" to "anon"; 73 + grant trigger on table "public"."leaflet_contributors" to "anon"; 74 + grant truncate on table "public"."leaflet_contributors" to "anon"; 75 + grant update on table "public"."leaflet_contributors" to "anon"; 76 + 77 + grant delete on table "public"."leaflet_contributors" to "authenticated"; 78 + grant insert on table "public"."leaflet_contributors" to "authenticated"; 79 + grant references on table "public"."leaflet_contributors" to "authenticated"; 80 + grant select on table "public"."leaflet_contributors" to "authenticated"; 81 + grant trigger on table "public"."leaflet_contributors" to "authenticated"; 82 + grant truncate on table "public"."leaflet_contributors" to "authenticated"; 83 + grant update on table "public"."leaflet_contributors" to "authenticated"; 84 + 85 + grant delete on table "public"."leaflet_contributors" to "service_role"; 86 + grant insert on table "public"."leaflet_contributors" to "service_role"; 87 + grant references on table "public"."leaflet_contributors" to "service_role"; 88 + grant select on table "public"."leaflet_contributors" to "service_role"; 89 + grant trigger on table "public"."leaflet_contributors" to "service_role"; 90 + grant truncate on table "public"."leaflet_contributors" to "service_role"; 91 + grant update on table "public"."leaflet_contributors" to "service_role";