This commit is contained in:
echo committed 2025-03-24 05:22:13 +01:00
1 parent 30255ce3c2
commit b2f52a25c7
5 files changed
+1543 -1935

No files matched your search

@@ -0,0 +1,42 @@
-- CreateTable
CREATE TABLE "Feed" (
"id" SERIAL NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT NOT NULL,
"link" TEXT NOT NULL,
"imageUrl" TEXT,
"lastBuildDate" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Feed_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Item" (
"id" SERIAL NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT NOT NULL,
"link" TEXT NOT NULL,
"pubDate" TEXT NOT NULL,
"guid" TEXT NOT NULL,
"categories" TEXT[],
"authors" TEXT[],
"feedId" INTEGER NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Item_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Feed_link_key" ON "Feed"("link");
-- CreateIndex
CREATE UNIQUE INDEX "Item_link_key" ON "Item"("link");
-- CreateIndex
CREATE UNIQUE INDEX "Item_guid_key" ON "Item"("guid");
-- AddForeignKey
ALTER TABLE "Item" ADD CONSTRAINT "Item_feedId_fkey" FOREIGN KEY ("feedId") REFERENCES "Feed"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
+28
View File
@@ -29,3 +29,31 @@ model Session {
@@map("sessions")
}
model Feed {
id Int @id @default(autoincrement())
title String
description String
link String @unique
imageUrl String?
lastBuildDate String
items Item[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Item {
id Int @id @default(autoincrement())
title String
description String
link String @unique
pubDate String
guid String @unique
categories String[]
authors String[]
feed Feed @relation(fields: [feedId], references: [id])
feedId Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}