From 4f6ef4b382e0c746dafee04f437528f980853c87 Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Thu, 30 Oct 2025 16:14:59 -0400 Subject: [PATCH] add comments tables --- ...schema_and_comments_notification_table.sql | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 supabase/migrations/20251030201428_add_notifications_schema_and_comments_notification_table.sql diff --git a/supabase/migrations/20251030201428_add_notifications_schema_and_comments_notification_table.sql b/supabase/migrations/20251030201428_add_notifications_schema_and_comments_notification_table.sql new file mode 100644 index 00000000..cdb3da54 --- /dev/null +++ b/supabase/migrations/20251030201428_add_notifications_schema_and_comments_notification_table.sql @@ -0,0 +1,24 @@ +create schema if not exists "notifications"; + +create table "notifications"."comment_notifications" ( + "comment" text not null, + "created_at" timestamp with time zone not null default now(), + "identity" uuid not null, + "reason" text not null, + "read" boolean not null default false +); + + +alter table "notifications"."comment_notifications" enable row level security; + +CREATE UNIQUE INDEX comment_notifications_pkey ON notifications.comment_notifications USING btree (comment, identity); + +alter table "notifications"."comment_notifications" add constraint "comment_notifications_pkey" PRIMARY KEY using index "comment_notifications_pkey"; + +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; + +alter table "notifications"."comment_notifications" validate constraint "comment_notifications_comment_fkey"; + +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; + +alter table "notifications"."comment_notifications" validate constraint "comment_notifications_identity_fkey"; -- 2.51.2