-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a2a4d8
commit 065e141
Showing
4 changed files
with
2,178 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
CREATE TABLE IF NOT EXISTS "notification_group" ( | ||
"id" uuid PRIMARY KEY NOT NULL, | ||
"name" text NOT NULL, | ||
"query" json NOT NULL, | ||
"notificationType" "digest_type" DEFAULT 'email' NOT NULL, | ||
"feedUrl" text, | ||
"seenLinks" json DEFAULT '[]'::json NOT NULL, | ||
"userId" uuid NOT NULL, | ||
"createdAt" timestamp (3) DEFAULT CURRENT_TIMESTAMP NOT NULL | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE IF NOT EXISTS "notification_item" ( | ||
"id" uuid PRIMARY KEY NOT NULL, | ||
"notificationGroupId" uuid NOT NULL, | ||
"itemData" json NOT NULL, | ||
"itemHtml" text, | ||
"createdAt" timestamp (3) DEFAULT CURRENT_TIMESTAMP NOT NULL | ||
); | ||
--> statement-breakpoint | ||
DO $$ BEGIN | ||
ALTER TABLE "notification_group" ADD CONSTRAINT "notification_group_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; | ||
--> statement-breakpoint | ||
DO $$ BEGIN | ||
ALTER TABLE "notification_item" ADD CONSTRAINT "notification_item_notificationGroupId_notification_group_id_fk" FOREIGN KEY ("notificationGroupId") REFERENCES "public"."notification_group"("id") ON DELETE cascade ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; |
Oops, something went wrong.