Major changes

This commit is contained in:
owenqwenstarsky
2026-01-24 16:52:19 -06:00
parent 011e40119d
commit 7181791734
46 changed files with 8371 additions and 127 deletions
@@ -0,0 +1,18 @@
-- CreateTable
CREATE TABLE "Article" (
"id" TEXT NOT NULL,
"slug" TEXT NOT NULL,
"title" TEXT NOT NULL,
"content" TEXT NOT NULL,
"imageUrl" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Article_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Article_slug_key" ON "Article"("slug");
-- CreateIndex
CREATE INDEX "Article_slug_idx" ON "Article"("slug");
@@ -0,0 +1,20 @@
-- CreateTable
CREATE TABLE "ArticleHistory" (
"id" TEXT NOT NULL,
"articleId" TEXT NOT NULL,
"oldContent" TEXT NOT NULL,
"newContent" TEXT NOT NULL,
"reason" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "ArticleHistory_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "ArticleHistory_articleId_idx" ON "ArticleHistory"("articleId");
-- CreateIndex
CREATE INDEX "ArticleHistory_createdAt_idx" ON "ArticleHistory"("createdAt");
-- AddForeignKey
ALTER TABLE "ArticleHistory" ADD CONSTRAINT "ArticleHistory_articleId_fkey" FOREIGN KEY ("articleId") REFERENCES "Article"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,11 @@
-- CreateTable
CREATE TABLE "Search" (
"id" TEXT NOT NULL,
"query" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Search_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "Search_createdAt_idx" ON "Search"("createdAt");
+3
View File
@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"
+44
View File
@@ -0,0 +1,44 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
}
model Article {
id String @id @default(cuid())
slug String @unique // URL-friendly title (e.g., "Albert_Einstein")
title String // Display title
content String @db.Text // Full markdown content
imageUrl String? // Main image URL
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
history ArticleHistory[]
@@index([slug])
}
model ArticleHistory {
id String @id @default(cuid())
articleId String
article Article @relation(fields: [articleId], references: [id], onDelete: Cascade)
oldContent String @db.Text
newContent String @db.Text
reason String // AI reason or "Initial article"
createdAt DateTime @default(now())
@@index([articleId])
@@index([createdAt])
}
model Search {
id String @id @default(cuid())
query String
createdAt DateTime @default(now())
@@index([createdAt])
}