a tool for shared writing and social publishing

remove bogus migrations and just add notifications table

+74 -120
+15 -15
app/lish/[did]/[publication]/[rkey]/Interactions/Comments/commentAction.ts
··· 65 65 } as unknown as Json, 66 66 }) 67 67 .select(); 68 - let notifications = [ 69 - { 70 - comment: uri.toString(), 71 - identity: new AtUri(args.document).host, 72 - reason: "reply-on-post", 73 - }, 74 - ]; 75 - if (args.comment.replyTo) 76 - notifications.push({ 77 - comment: uri.toString(), 78 - identity: new AtUri(args.comment.replyTo).host, 79 - reason: "reply-to-comment", 80 - }); 81 - // SOMEDAY: move this out the action with inngest or workflows 82 - await supabaseServerClient.from("notif_comments").insert(notifications); 68 + // let notifications = [ 69 + // { 70 + // comment: uri.toString(), 71 + // identity: new AtUri(args.document).host, 72 + // reason: "reply-on-post", 73 + // }, 74 + // ]; 75 + // if (args.comment.replyTo) 76 + // notifications.push({ 77 + // comment: uri.toString(), 78 + // identity: new AtUri(args.comment.replyTo).host, 79 + // reason: "reply-to-comment", 80 + // }); 81 + // // SOMEDAY: move this out the action with inngest or workflows 82 + // await supabaseServerClient.from("notif_comments").insert(notifications); 83 83 84 84 return { 85 85 record: data?.[0].record as Json,
-24
supabase/migrations/20251030201428_add_notifications_schema_and_comments_notification_table.sql
··· 1 - create schema if not exists "notifications"; 2 - 3 - create table "notifications"."comment_notifications" ( 4 - "comment" text not null, 5 - "created_at" timestamp with time zone not null default now(), 6 - "identity" uuid not null, 7 - "reason" text not null, 8 - "read" boolean not null default false 9 - ); 10 - 11 - 12 - alter table "notifications"."comment_notifications" enable row level security; 13 - 14 - CREATE UNIQUE INDEX comment_notifications_pkey ON notifications.comment_notifications USING btree (comment, identity); 15 - 16 - alter table "notifications"."comment_notifications" add constraint "comment_notifications_pkey" PRIMARY KEY using index "comment_notifications_pkey"; 17 - 18 - alter table "notifications"."comment_notifications" add constraint "comment_notifications_comment_fkey" FOREIGN KEY (comment) REFERENCES comments_on_documents(uri) ON UPDATE CASCADE ON DELETE CASCADE not valid; 19 - 20 - alter table "notifications"."comment_notifications" validate constraint "comment_notifications_comment_fkey"; 21 - 22 - alter table "notifications"."comment_notifications" add constraint "comment_notifications_identity_fkey" FOREIGN KEY (identity) REFERENCES identities(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; 23 - 24 - alter table "notifications"."comment_notifications" validate constraint "comment_notifications_identity_fkey";
-7
supabase/migrations/20251030203149_add_grants_and_priveleges_to_notifications_schema.sql
··· 1 - GRANT USAGE ON SCHEMA notifications TO anon, authenticated, service_role; 2 - GRANT ALL ON ALL TABLES IN SCHEMA notifications TO anon, authenticated, service_role; 3 - GRANT ALL ON ALL ROUTINES IN SCHEMA notifications TO anon, authenticated, service_role; 4 - GRANT ALL ON ALL SEQUENCES IN SCHEMA notifications TO anon, authenticated, service_role; 5 - ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA notifications GRANT ALL ON TABLES TO anon, authenticated, service_role; 6 - ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA notifications GRANT ALL ON ROUTINES TO anon, authenticated, service_role; 7 - ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA notifications GRANT ALL ON SEQUENCES TO anon, authenticated, service_role;
-67
supabase/migrations/20251030205840_move_notif_table_to_public.sql
··· 1 - create table "public"."notif_comments" ( 2 - "comment" text not null, 3 - "created_at" timestamp with time zone not null default now(), 4 - "identity" uuid not null, 5 - "reason" text not null, 6 - "read" boolean not null default false 7 - ); 8 - 9 - 10 - alter table "public"."notif_comments" enable row level security; 11 - 12 - CREATE UNIQUE INDEX notif_comments_pkey ON public.notif_comments USING btree (comment, identity); 13 - 14 - alter table "public"."notif_comments" add constraint "notif_comments_pkey" PRIMARY KEY using index "notif_comments_pkey"; 15 - 16 - alter table "public"."notif_comments" add constraint "notif_comments_comment_fkey" FOREIGN KEY (comment) REFERENCES comments_on_documents(uri) ON UPDATE CASCADE ON DELETE CASCADE not valid; 17 - 18 - alter table "public"."notif_comments" validate constraint "notif_comments_comment_fkey"; 19 - 20 - alter table "public"."notif_comments" add constraint "notif_comments_identity_fkey" FOREIGN KEY (identity) REFERENCES identities(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; 21 - 22 - alter table "public"."notif_comments" validate constraint "notif_comments_identity_fkey"; 23 - 24 - grant delete on table "public"."notif_comments" to "anon"; 25 - 26 - grant insert on table "public"."notif_comments" to "anon"; 27 - 28 - grant references on table "public"."notif_comments" to "anon"; 29 - 30 - grant select on table "public"."notif_comments" to "anon"; 31 - 32 - grant trigger on table "public"."notif_comments" to "anon"; 33 - 34 - grant truncate on table "public"."notif_comments" to "anon"; 35 - 36 - grant update on table "public"."notif_comments" to "anon"; 37 - 38 - grant delete on table "public"."notif_comments" to "authenticated"; 39 - 40 - grant insert on table "public"."notif_comments" to "authenticated"; 41 - 42 - grant references on table "public"."notif_comments" to "authenticated"; 43 - 44 - grant select on table "public"."notif_comments" to "authenticated"; 45 - 46 - grant trigger on table "public"."notif_comments" to "authenticated"; 47 - 48 - grant truncate on table "public"."notif_comments" to "authenticated"; 49 - 50 - grant update on table "public"."notif_comments" to "authenticated"; 51 - 52 - grant delete on table "public"."notif_comments" to "service_role"; 53 - 54 - grant insert on table "public"."notif_comments" to "service_role"; 55 - 56 - grant references on table "public"."notif_comments" to "service_role"; 57 - 58 - grant select on table "public"."notif_comments" to "service_role"; 59 - 60 - grant trigger on table "public"."notif_comments" to "service_role"; 61 - 62 - grant truncate on table "public"."notif_comments" to "service_role"; 63 - 64 - grant update on table "public"."notif_comments" to "service_role"; 65 - 66 - drop table "notifications"."comment_notifications"; 67 - drop schema if exists "notifications";
-7
supabase/migrations/20251030211410_notif_relate_to_atp_did_not_id.sql
··· 1 - alter table "public"."notif_comments" drop constraint "notif_comments_identity_fkey"; 2 - 3 - alter table "public"."notif_comments" alter column "identity" set data type text using "identity"::text; 4 - 5 - alter table "public"."notif_comments" add constraint "notif_comments_identity_fkey" FOREIGN KEY (identity) REFERENCES identities(atp_did) ON UPDATE CASCADE ON DELETE CASCADE not valid; 6 - 7 - alter table "public"."notif_comments" validate constraint "notif_comments_identity_fkey";
+59
supabase/migrations/20251030215033_add_notifications_table.sql
··· 1 + create table "public"."notifications" ( 2 + "recipient" text not null, 3 + "created_at" timestamp with time zone not null default now(), 4 + "read" boolean not null default false, 5 + "data" jsonb not null 6 + ); 7 + 8 + 9 + alter table "public"."notifications" enable row level security; 10 + 11 + CREATE UNIQUE INDEX notifications_pkey ON public.notifications USING btree (recipient); 12 + 13 + alter table "public"."notifications" add constraint "notifications_pkey" PRIMARY KEY using index "notifications_pkey"; 14 + 15 + alter table "public"."notifications" add constraint "notifications_recipient_fkey" FOREIGN KEY (recipient) REFERENCES identities(atp_did) ON UPDATE CASCADE ON DELETE CASCADE not valid; 16 + 17 + alter table "public"."notifications" validate constraint "notifications_recipient_fkey"; 18 + 19 + grant delete on table "public"."notifications" to "anon"; 20 + 21 + grant insert on table "public"."notifications" to "anon"; 22 + 23 + grant references on table "public"."notifications" to "anon"; 24 + 25 + grant select on table "public"."notifications" to "anon"; 26 + 27 + grant trigger on table "public"."notifications" to "anon"; 28 + 29 + grant truncate on table "public"."notifications" to "anon"; 30 + 31 + grant update on table "public"."notifications" to "anon"; 32 + 33 + grant delete on table "public"."notifications" to "authenticated"; 34 + 35 + grant insert on table "public"."notifications" to "authenticated"; 36 + 37 + grant references on table "public"."notifications" to "authenticated"; 38 + 39 + grant select on table "public"."notifications" to "authenticated"; 40 + 41 + grant trigger on table "public"."notifications" to "authenticated"; 42 + 43 + grant truncate on table "public"."notifications" to "authenticated"; 44 + 45 + grant update on table "public"."notifications" to "authenticated"; 46 + 47 + grant delete on table "public"."notifications" to "service_role"; 48 + 49 + grant insert on table "public"."notifications" to "service_role"; 50 + 51 + grant references on table "public"."notifications" to "service_role"; 52 + 53 + grant select on table "public"."notifications" to "service_role"; 54 + 55 + grant trigger on table "public"."notifications" to "service_role"; 56 + 57 + grant truncate on table "public"."notifications" to "service_role"; 58 + 59 + grant update on table "public"."notifications" to "service_role";