101 lines
2.3 KiB
Plaintext
101 lines
2.3 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
|
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
email String @unique
|
|
username String @unique
|
|
password String
|
|
avatar String?
|
|
bio String?
|
|
language String @default("en")
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
prompts Prompt[]
|
|
|
|
@@map("users")
|
|
}
|
|
|
|
model Prompt {
|
|
id String @id @default(cuid())
|
|
name String
|
|
content String
|
|
description String?
|
|
isPublic Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
tags PromptTag[]
|
|
versions PromptVersion[]
|
|
album PromptAlbum? @relation(fields: [albumId], references: [id])
|
|
albumId String?
|
|
tests PromptTestRun[]
|
|
|
|
@@map("prompts")
|
|
}
|
|
|
|
model PromptVersion {
|
|
id String @id @default(cuid())
|
|
version Int
|
|
content String
|
|
changelog String?
|
|
createdAt DateTime @default(now())
|
|
|
|
promptId String
|
|
prompt Prompt @relation(fields: [promptId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([promptId, version])
|
|
@@map("prompt_versions")
|
|
}
|
|
|
|
model PromptTag {
|
|
id String @id @default(cuid())
|
|
name String @unique
|
|
color String @default("#3B82F6")
|
|
|
|
prompts Prompt[]
|
|
|
|
@@map("prompt_tags")
|
|
}
|
|
|
|
model PromptAlbum {
|
|
id String @id @default(cuid())
|
|
name String
|
|
description String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
prompts Prompt[]
|
|
|
|
@@map("prompt_albums")
|
|
}
|
|
|
|
model PromptTestRun {
|
|
id String @id @default(cuid())
|
|
input String
|
|
output String?
|
|
success Boolean @default(false)
|
|
error String?
|
|
createdAt DateTime @default(now())
|
|
|
|
promptId String
|
|
prompt Prompt @relation(fields: [promptId], references: [id], onDelete: Cascade)
|
|
|
|
@@map("prompt_test_runs")
|
|
}
|