82 lines
2.1 KiB
Plaintext
82 lines
2.1 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model Guild {
|
|
id String @id
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
settings GuildSettings?
|
|
cases Case[]
|
|
}
|
|
|
|
model GuildSettings {
|
|
id String @id @default(cuid())
|
|
guildId String @unique
|
|
locale String @default("de")
|
|
moderationEnabled Boolean @default(true)
|
|
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model User {
|
|
id String @id
|
|
createdAt DateTime @default(now())
|
|
warnings Warning[]
|
|
notes ModNote[]
|
|
}
|
|
|
|
model Case {
|
|
id String @id @default(cuid())
|
|
caseNumber Int
|
|
guildId String
|
|
targetUserId String
|
|
moderatorId String
|
|
action String
|
|
reason String?
|
|
metadata Json?
|
|
deletedAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
|
|
warnings Warning[]
|
|
moderationNote ModNote[]
|
|
|
|
@@unique([guildId, caseNumber])
|
|
@@index([guildId, targetUserId])
|
|
}
|
|
|
|
model Warning {
|
|
id String @id @default(cuid())
|
|
guildId String
|
|
userId String
|
|
moderatorId String
|
|
reason String?
|
|
caseId String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
case Case? @relation(fields: [caseId], references: [id], onDelete: SetNull)
|
|
|
|
@@index([guildId, userId])
|
|
}
|
|
|
|
model ModNote {
|
|
id String @id @default(cuid())
|
|
guildId String
|
|
userId String
|
|
moderatorId String
|
|
note String
|
|
caseId String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
case Case? @relation(fields: [caseId], references: [id], onDelete: SetNull)
|
|
|
|
@@index([guildId, userId])
|
|
}
|