2024-07-09 21:54:17 -07:00
|
|
|
// This is your Prisma schema file,
|
|
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
|
|
|
|
generator client {
|
2024-11-19 17:34:49 -08:00
|
|
|
provider = "prisma-client-js"
|
2024-07-11 02:38:57 -07:00
|
|
|
binaryTargets = ["native", "debian-openssl-1.1.x"]
|
2024-07-09 21:54:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
datasource db {
|
|
|
|
provider = "sqlite"
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
|
|
|
model Token {
|
2024-11-19 17:34:49 -08:00
|
|
|
id String @id @unique @default(uuid())
|
|
|
|
owner String
|
|
|
|
token String
|
2024-07-10 00:23:38 -07:00
|
|
|
refreshToken String?
|
2024-07-10 19:17:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
model User {
|
2024-11-22 19:31:11 -08:00
|
|
|
userId String @id @unique
|
|
|
|
identifier String
|
|
|
|
name String?
|
|
|
|
avatars Avatar[]
|
|
|
|
webhooks Webhook[]
|
|
|
|
emailHashes EmailHashes[]
|
|
|
|
primaryEmail EmailHashes? @relation("PrimaryEmail")
|
2024-11-19 17:34:49 -08:00
|
|
|
|
2024-11-20 02:17:45 -08:00
|
|
|
currentAvatarId String? @unique
|
|
|
|
currentAvatar Avatar? @relation("CurrentAvatar", fields: [currentAvatarId], references: [id])
|
2024-08-22 21:31:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
model Avatar {
|
2024-11-19 17:34:49 -08:00
|
|
|
id String @id @unique @default(uuid())
|
|
|
|
user User @relation(fields: [userId], references: [userId])
|
|
|
|
userId String
|
|
|
|
|
2024-11-20 02:17:45 -08:00
|
|
|
usedBy User? @relation("CurrentAvatar")
|
2024-11-19 17:34:49 -08:00
|
|
|
|
2024-08-22 21:31:21 -07:00
|
|
|
altText String?
|
2024-11-19 17:34:49 -08:00
|
|
|
source String?
|
|
|
|
}
|
2024-11-20 13:03:46 -08:00
|
|
|
|
|
|
|
model Webhook {
|
|
|
|
userId String
|
|
|
|
user User @relation(fields: [userId], references: [userId])
|
|
|
|
url String
|
|
|
|
enabled Boolean @default(true)
|
|
|
|
|
|
|
|
@@unique([url, userId])
|
|
|
|
}
|
2024-11-20 19:36:24 -08:00
|
|
|
|
|
|
|
model EmailHashes {
|
2024-11-22 19:31:11 -08:00
|
|
|
id String @id @default(uuid())
|
|
|
|
|
|
|
|
forUserId String
|
2024-11-20 19:36:24 -08:00
|
|
|
user User @relation(fields: [forUserId], references: [userId])
|
2024-11-22 19:31:11 -08:00
|
|
|
|
|
|
|
email String @unique @default("unknown:${uuid()}")
|
|
|
|
sha256 Bytes
|
|
|
|
md5 Bytes
|
|
|
|
|
|
|
|
isPrimaryForUserId String? @unique
|
|
|
|
isPrimaryFor User? @relation("PrimaryEmail", fields: [isPrimaryForUserId], references: [userId])
|
|
|
|
|
|
|
|
@@unique([sha256, md5])
|
2024-11-20 19:36:24 -08:00
|
|
|
}
|