Changes sessions to be stored in the DB, this ensures that sessions persist after a restart!

This commit is contained in:
Cameron Redmore 2025-04-25 13:03:25 +01:00
parent 83d93aefc0
commit 1f9bb34853
5 changed files with 103 additions and 30 deletions

View file

@ -0,0 +1,12 @@
-- CreateTable
CREATE TABLE "Session" (
"id" TEXT NOT NULL,
"sid" TEXT NOT NULL,
"data" TEXT NOT NULL,
"expires_at" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Session_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Session_sid_key" ON "Session"("sid");

View file

@ -121,3 +121,11 @@ model ChatMessage {
createdAt DateTime @default(now()) @map("created_at")
thread ChatThread @relation(fields: [threadId], references: [id], onDelete: Cascade)
}
// Add this model for session storage
model Session {
id String @id
sid String @unique
data String
expiresAt DateTime @map("expires_at")
}