69 lines
1.6 KiB
Plaintext
69 lines
1.6 KiB
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"
|
|
binaryTargets = ["native", "debian-openssl-1.1.x"]
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model Token {
|
|
id String @id @unique @default(uuid())
|
|
owner String
|
|
token String
|
|
refreshToken String?
|
|
}
|
|
|
|
model User {
|
|
userId String @id @unique
|
|
identifier String
|
|
name String?
|
|
avatars Avatar[]
|
|
webhooks Webhook[]
|
|
emailHashes EmailHashes[]
|
|
primaryEmail EmailHashes? @relation("PrimaryEmail")
|
|
|
|
currentAvatarId String? @unique
|
|
currentAvatar Avatar? @relation("CurrentAvatar", fields: [currentAvatarId], references: [id])
|
|
}
|
|
|
|
model Avatar {
|
|
id String @id @unique @default(uuid())
|
|
user User @relation(fields: [userId], references: [userId])
|
|
userId String
|
|
|
|
usedBy User? @relation("CurrentAvatar")
|
|
|
|
altText String?
|
|
source String?
|
|
}
|
|
|
|
model Webhook {
|
|
userId String
|
|
user User @relation(fields: [userId], references: [userId])
|
|
url String
|
|
enabled Boolean @default(true)
|
|
|
|
@@unique([url, userId])
|
|
}
|
|
|
|
model EmailHashes {
|
|
id String @id @default(uuid())
|
|
|
|
forUserId String
|
|
user User @relation(fields: [forUserId], references: [userId])
|
|
|
|
email String @unique @default("unknown:${uuid()}")
|
|
sha256 Bytes
|
|
md5 Bytes
|
|
|
|
isPrimaryForUserId String? @unique
|
|
isPrimaryFor User? @relation("PrimaryEmail", fields: [isPrimaryForUserId], references: [userId])
|
|
|
|
@@unique([sha256, md5])
|
|
}
|