38 lines
875 B
Plaintext
38 lines
875 B
Plaintext
// 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 = "sqlite"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
username String @unique
|
|
password String
|
|
chats Chat[]
|
|
}
|
|
|
|
model Chat {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
title String
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id])
|
|
messages Message[]
|
|
}
|
|
|
|
model Message {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
role String // 'user' or 'assistant'
|
|
content String
|
|
chatId String
|
|
chat Chat @relation(fields: [chatId], references: [id], onDelete: Cascade)
|
|
}
|