hermes-web/prisma/schema.prisma

111 lines
2.2 KiB
Plaintext
Raw Normal View History

2023-12-30 05:56:40 -05:00
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
relationMode = "prisma"
}
model User {
id String @id @default(uuid())
username String @unique
apiKeys ApiKey[]
twitchConnections TwitchConnection[]
createdProfiles TtsProfile[]
profileStatus TtsProfileStatus[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model ApiKey {
id String @id @default(uuid())
label String
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@index([userId])
}
model TwitchConnection {
broadcasterId String @unique
accessToken String
refreshToken String
userId String @id
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@index([userId])
}
model TtsProfile {
id String @id @default(uuid())
name String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
statuses TtsProfileStatus[]
badgeFilters TtsBadgeFilter[]
usernameFilters TtsUsernameFilter[]
wordFilters TtsWordReplacementFilter[]
creatorId String
creator User @relation(fields: [creatorId], references: [id], onDelete: Cascade)
@@index([creatorId])
@@unique([creatorId, name])
}
model TtsProfileStatus {
id String @id @default(uuid())
name String
enabled Boolean
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
profileId String
profile TtsProfile @relation(fields: [profileId], references: [id], onDelete: Cascade)
@@index([userId])
@@index([profileId])
}
model TtsBadgeFilter {
badgeId String
profileId String
profile TtsProfile @relation(fields: [profileId], references: [id], onDelete: Cascade)
@@index([profileId])
@@id([profileId, badgeId])
}
model TtsUsernameFilter {
username String
white Boolean
profileId String
profile TtsProfile @relation(fields: [profileId], references: [id], onDelete: Cascade)
@@index([profileId])
@@id([profileId, username])
}
model TtsWordReplacementFilter {
word String
replace String
profileId String
profile TtsProfile @relation(fields: [profileId], references: [id], onDelete: Cascade)
@@index([profileId])
@@id([profileId, word])
}