hermes-web/prisma/schema.prisma

223 lines
5.2 KiB
Plaintext
Raw Normal View History

2023-12-30 05:56:40 -05:00
generator client {
provider = "prisma-client-js"
2023-12-30 05:56:40 -05:00
}
// datasource db {
// provider = "mysql"
// url = env("DATABASE_URL")
// relationMode = "prisma"
// }
2023-12-30 05:56:40 -05:00
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
2023-12-30 05:56:40 -05:00
}
2024-01-04 03:56:24 -05:00
enum UserRole {
USER
ADMIN
2024-01-04 03:56:24 -05:00
}
2023-12-30 05:56:40 -05:00
model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
role UserRole @default(USER)
image String?
ttsDefaultVoice String @default("Brian")
impersonationSources Impersonation[] @relation(name: "impersonationSources")
impersonationTargets Impersonation[] @relation(name: "impersonationTargets")
apiKeys ApiKey[]
accounts Account[]
twitchConnections TwitchConnection[]
ttsUsernameFilter TtsUsernameFilter[]
ttsWordFilter TtsWordFilter[]
ttsChatVoices TtsChatVoice[]
ttsVoiceStates TtsVoiceState[]
actions Action[]
redemptions Redemption[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
2023-12-30 05:56:40 -05:00
}
2024-01-02 02:26:20 -05:00
model Account {
id String @id @default(cuid())
userId String
type String
provider String
providerAccountId String
refresh_token String? @db.Text
access_token String? @db.Text
expires_at Int?
token_type String?
scope String?
id_token String? @db.Text
session_state String?
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
@@unique([provider, providerAccountId])
2024-01-04 16:57:32 -05:00
}
model Impersonation {
sourceId String
targetId String
2024-01-04 16:57:32 -05:00
source User @relation(name: "impersonationSources", fields: [sourceId], references: [id], onDelete: Cascade, onUpdate: Cascade)
target User @relation(name: "impersonationTargets", fields: [targetId], references: [id], onDelete: Cascade, onUpdate: Cascade)
2024-01-04 16:57:32 -05:00
@@id([sourceId])
@@index([sourceId])
@@index([targetId])
2024-01-02 02:26:20 -05:00
}
2023-12-30 05:56:40 -05:00
model ApiKey {
id String @id @default(uuid())
label String
2023-12-30 05:56:40 -05:00
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
2023-12-30 05:56:40 -05:00
}
model TwitchConnection {
broadcasterId String @unique
accessToken String
refreshToken String
2023-12-30 05:56:40 -05:00
userId String @id
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
2023-12-30 05:56:40 -05:00
}
model TtsUsernameFilter {
username String
tag String
2023-12-30 05:56:40 -05:00
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
2023-12-30 05:56:40 -05:00
@@id([userId, username])
2023-12-30 05:56:40 -05:00
}
2024-01-02 13:00:11 -05:00
model TtsWordFilter {
id String @id @default(cuid())
search String
replace String
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
@@unique([userId, search])
}
model TtsVoice {
id String @id @default(cuid())
name String
2023-12-30 05:56:40 -05:00
ttsChatVoices TtsChatVoice[]
ttsVoiceStates TtsVoiceState[]
}
2023-12-30 05:56:40 -05:00
model TtsChatVoice {
userId String
chatterId BigInt
ttsVoiceId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
voice TtsVoice @relation(fields: [ttsVoiceId], references: [id], onDelete: Cascade, onUpdate: Cascade)
@@id([userId, chatterId])
@@index([userId])
}
model TtsVoiceState {
userId String
ttsVoiceId String
state Boolean @default(true)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
voice TtsVoice @relation(fields: [ttsVoiceId], references: [id], onDelete: Cascade, onUpdate: Cascade)
@@id([userId, ttsVoiceId])
}
model Chatter {
id BigInt
name String
ban DateTime @default(dbgenerated("'1970-01-01 00:00:00.000'"))
//history EmoteUsageHistory[]
@@id([id])
}
model Emote {
id String
name String
//history EmoteUsageHistory[]
@@id([id])
}
model EmoteUsageHistory {
timestamp DateTime
broadcasterId BigInt
emoteId String
chatterId BigInt
//emote Emote @relation(fields: [emoteId], references: [id], onDelete: Cascade, onUpdate: Cascade)
//chatter Chatter @relation(fields: [chatterId], references: [id], onDelete: Cascade, onUpdate: Cascade)
@@id([timestamp, emoteId, chatterId])
}
enum ActionType {
WRITE_TO_FILE
APPEND_TO_FILE
AUDIO_FILE
OBS_TRANSFORM
}
model Action {
userId String
name String @unique
type ActionType
data Json
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@id([userId, name])
}
model Redemption {
id String @id @default(uuid()) @db.Uuid
userId String
redemptionId String
actionName String
order Int
state Boolean
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
model Quest {
id Int @id @default(autoincrement())
type Int
target Int
start DateTime
end DateTime
@@unique([type, start])
}
model QuestProgression {
chatterId BigInt
questId Int
counter Int
@@id([chatterId, questId])
}