summaryrefslogtreecommitdiff
path: root/db/migrations/0213_ordinary_orphan.sql
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrations/0213_ordinary_orphan.sql')
-rw-r--r--db/migrations/0213_ordinary_orphan.sql17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrations/0213_ordinary_orphan.sql b/db/migrations/0213_ordinary_orphan.sql
new file mode 100644
index 00000000..682418ed
--- /dev/null
+++ b/db/migrations/0213_ordinary_orphan.sql
@@ -0,0 +1,17 @@
+CREATE TABLE "notifications" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "user_id" varchar(255) NOT NULL,
+ "title" varchar(255) NOT NULL,
+ "message" text NOT NULL,
+ "type" varchar(50) NOT NULL,
+ "related_record_id" varchar(255),
+ "related_record_type" varchar(100),
+ "is_read" boolean DEFAULT false NOT NULL,
+ "created_at" timestamp DEFAULT now() NOT NULL,
+ "read_at" timestamp
+);
+--> statement-breakpoint
+CREATE INDEX "idx_notifications_user_id" ON "notifications" USING btree ("user_id");--> statement-breakpoint
+CREATE INDEX "idx_notifications_created_at" ON "notifications" USING btree ("created_at" DESC NULLS LAST);--> statement-breakpoint
+CREATE INDEX "idx_notifications_is_read" ON "notifications" USING btree ("is_read");--> statement-breakpoint
+CREATE INDEX "idx_notifications_user_read" ON "notifications" USING btree ("user_id","is_read"); \ No newline at end of file