ChatGPT-Next-Web/prisma/schema.prisma
2024-05-03 17:00:12 +08:00

150 lines
6.2 KiB
Plaintext

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
datasource db {
provider = "postgresql"
url = env("POSTGRES_PRISMA_URL") // uses connection pooling
// directUrl = env("POSTGRES_URL_NON_POOLING") // uses a direct connection
}
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl-openssl-3.0.x", "linux-musl-arm64-openssl-3.0.x"]
}
model User {
id String @id @default(cuid())
name String? @unique
// if you are using Github OAuth, you can get rid of the username attribute (that is for Twitter OAuth)
username String? @unique
gh_username String? @unique
email String? @unique
emailVerified DateTime?
image String?
password String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
allowToLogin Boolean @default(true)
isAdmin Boolean? @default(false)
accounts Account[]
sessions Session[]
// sites Site[]
// posts Post[]
logs LogEntry[]
}
model Account {
id String @id @default(cuid())
userId String
type String
provider String
providerAccountId String
refresh_token String?
refresh_token_expires_in Int?
access_token String?
expires_at Int?
token_type String?
scope String?
id_token String?
session_state String?
oauth_token_secret String?
oauth_token String?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([provider, providerAccountId])
@@index([userId])
}
model Session {
id String @id @default(cuid())
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@index([userId])
}
model LogEntry {
id Int @id @default(autoincrement())
ip String? @db.VarChar(50) // IPV6 long 39
path String? @db.Text
model String? @db.VarChar(25)
userName String? @db.VarChar(50)
userID String?
createdAt DateTime @default(now())
// logEntry String? @db.Text
logToken Int? @default(0)
user User? @relation(fields: [userID], references: [id], onDelete: SetNull)
}
model VerificationToken {
identifier String
token String @unique
expires DateTime
@@unique([identifier, token])
}
// model Post {
// id String @id @default(cuid())
// title String? @db.Text
// description String? @db.Text
// content String? @db.Text
// slug String @default(cuid())
// image String? @default("https://public.blob.vercel-storage.com/eEZHAoPTOBSYGBE3/hxfcV5V-eInX3jbVUhjAt1suB7zB88uGd1j20b.png") @db.Text
// imageBlurhash String? @default("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAhCAYAAACbffiEAAAACXBIWXMAABYlAAAWJQFJUiTwAAABfUlEQVR4nN3XyZLDIAwE0Pz/v3q3r55JDlSBplsIEI49h76k4opexCK/juP4eXjOT149f2Tf9ySPgcjCc7kdpBTgDPKByKK2bTPFEdMO0RDrusJ0wLRBGCIuelmWJAjkgPGDSIQEMBDCfA2CEPM80+Qwl0JkNxBimiaYGOTUlXYI60YoehzHJDEm7kxjV3whOQTD3AaCuhGKHoYhyb+CBMwjIAFz647kTqyapdV4enGINuDJMSScPmijSwjCaHeLcT77C7EC0C1ugaCTi2HYfAZANgj6Z9A8xY5eiYghDMNQBJNCWhASot0jGsSCUiHWZcSGQjaWWCDaGMOWnsCcn2QhVkRuxqqNxMSdUSElCDbp1hbNOsa6Ugxh7xXauF4DyM1m5BLtCylBXgaxvPXVwEoOBjeIFVODtW74oj1yBQah3E8tyz3SkpolKS9Geo9YMD1QJR1Go4oJkgO1pgbNZq0AOUPChyjvh7vlXaQa+X1UXwKxgHokB2XPxbX+AnijwIU4ahazAAAAAElFTkSuQmCC") @db.Text
// createdAt DateTime @default(now())
// updatedAt DateTime @updatedAt
// published Boolean @default(false)
// site Site? @relation(fields: [siteId], references: [id], onDelete: Cascade, onUpdate: Cascade)
// siteId String?
// user User? @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
// userId String?
//
// @@unique([slug, siteId])
// @@index([siteId])
// @@index([userId])
// }
// model Site {
// id String @id @default(cuid())
// name String?
// description String? @db.Text
// logo String? @default("https://public.blob.vercel-storage.com/eEZHAoPTOBSYGBE3/JRajRyC-PhBHEinQkupt02jqfKacBVHLWJq7Iy.png") @db.Text
// font String @default("font-cal")
// image String? @default("https://public.blob.vercel-storage.com/eEZHAoPTOBSYGBE3/hxfcV5V-eInX3jbVUhjAt1suB7zB88uGd1j20b.png") @db.Text
// imageBlurhash String? @default("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAhCAYAAACbffiEAAAACXBIWXMAABYlAAAWJQFJUiTwAAABfUlEQVR4nN3XyZLDIAwE0Pz/v3q3r55JDlSBplsIEI49h76k4opexCK/juP4eXjOT149f2Tf9ySPgcjCc7kdpBTgDPKByKK2bTPFEdMO0RDrusJ0wLRBGCIuelmWJAjkgPGDSIQEMBDCfA2CEPM80+Qwl0JkNxBimiaYGOTUlXYI60YoehzHJDEm7kxjV3whOQTD3AaCuhGKHoYhyb+CBMwjIAFz647kTqyapdV4enGINuDJMSScPmijSwjCaHeLcT77C7EC0C1ugaCTi2HYfAZANgj6Z9A8xY5eiYghDMNQBJNCWhASot0jGsSCUiHWZcSGQjaWWCDaGMOWnsCcn2QhVkRuxqqNxMSdUSElCDbp1hbNOsa6Ugxh7xXauF4DyM1m5BLtCylBXgaxvPXVwEoOBjeIFVODtW74oj1yBQah3E8tyz3SkpolKS9Geo9YMD1QJR1Go4oJkgO1pgbNZq0AOUPChyjvh7vlXaQa+X1UXwKxgHokB2XPxbX+AnijwIU4ahazAAAAAElFTkSuQmCC") @db.Text
// subdomain String? @unique
// customDomain String? @unique
// message404 String? @default("Blimey! You've found a page that doesn't exist.") @db.Text
// createdAt DateTime @default(now())
// updatedAt DateTime @updatedAt
// user User? @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
// userId String?
// posts Post[]
//
// @@index([userId])
// }
// model Example {
// id Int @id @default(autoincrement())
// name String?
// description String? @db.Text
// domainCount Int?
// url String?
// image String? @db.Text
// imageBlurhash String? @db.Text
// }
model Setting {
key String @id
value String
type String
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
@@map("settings")
}