a tool for shared writing and social publishing

add comments tables

+24
+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";