From 6761a9163bf5e3aef9cdb99b0dbaa70eef43d72d Mon Sep 17 00:00:00 2001 From: Corban-Lee Jones Date: Thu, 8 May 2025 01:14:35 +0100 Subject: [PATCH] feat: publish threshold field on Feed model --- .../migration.sql | 12 ++++++++++ prisma/schema.prisma | 23 ++++++++++--------- 2 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 prisma/migrations/20250506174806_add_publish_threshold_to_feed/migration.sql diff --git a/prisma/migrations/20250506174806_add_publish_threshold_to_feed/migration.sql b/prisma/migrations/20250506174806_add_publish_threshold_to_feed/migration.sql new file mode 100644 index 0000000..88d77ac --- /dev/null +++ b/prisma/migrations/20250506174806_add_publish_threshold_to_feed/migration.sql @@ -0,0 +1,12 @@ +/* + Warnings: + + - Added the required column `published_threshold` to the `Feed` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE "Feed" ADD COLUMN "message_style_id" INTEGER, +ADD COLUMN "published_threshold" TIMESTAMP(3) NOT NULL; + +-- AddForeignKey +ALTER TABLE "Feed" ADD CONSTRAINT "Feed_message_style_id_fkey" FOREIGN KEY ("message_style_id") REFERENCES "MessageStyle"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 1b848ca..602b3d7 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -12,17 +12,18 @@ datasource db { } model Feed { - id Int @id @default(autoincrement()) - name String - url String - guild_id String - active Boolean - created_at DateTime @default(now()) - updated_at DateTime @updatedAt - channels Channel[] - filters Filter[] - message_style MessageStyle? @relation(fields: [message_style_id], references: [id], onDelete: SetNull) - message_style_id Int? + id Int @id @default(autoincrement()) + name String + url String + guild_id String + active Boolean + created_at DateTime @default(now()) + updated_at DateTime @updatedAt + channels Channel[] + filters Filter[] + message_style MessageStyle? @relation(fields: [message_style_id], references: [id], onDelete: SetNull) + message_style_id Int? + published_threshold DateTime @@unique([guild_id, name]) @@index([guild_id, created_at(sort: Desc)])