arabot/prisma/schema.prisma
2023-02-27 16:43:08 +00:00

204 lines
7.7 KiB
Plaintext

// SPDX-License-Identifier: GPL-3.0-or-later
// Animal Rights Advocates Discord Bot
// Copyright (C) 2022 Anthony Berg
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id @db.VarChar(255)
vegan Boolean @default(false)
trusted Boolean @default(false)
activist Boolean @default(false)
plus Boolean @default(false)
notVegan Boolean @default(false)
vegCurious Boolean @default(false)
convinced Boolean @default(false)
muted Boolean @default(false)
VerifyUser Verify[] @relation("verUser")
VerifyVerifier Verify[] @relation("verVerifier")
EventLeader Event[] @relation("eventLeader")
StatLeader Stat[] @relation("statLeader")
OutreachParticipation ParticipantStat[] @relation("participantUser")
SusUser Sus[] @relation("susUser")
SusMod Sus[] @relation("susMod")
WarnUser Warning[] @relation("warnUser")
WarnMod Warning[] @relation("warnMod")
RestrictUser Restrict[] @relation("restUser")
RestrictMod Restrict[] @relation("restMod")
RestrictEndMod Restrict[] @relation("endRestMod")
BanUser Ban[] @relation("banUser")
BanMod Ban[] @relation("banMod")
BanEndMod Ban[] @relation("endBanMod")
TempBanUser TempBan[] @relation("tbanUser")
TempBanMod TempBan[] @relation("tbanMod")
TempBanEndMod TempBan[] @relation("endTbanMod")
VCMuteUser VCMute[] @relation("vcMuteUser")
VCMuteMod VCMute[] @relation("vcMuteMod")
}
model Verify {
id String @id
user User @relation("verUser", fields: [userId], references: [id])
userId String
verifier User? @relation("verVerifier", fields: [verifierId], references: [id])
verifierId String?
joinTime DateTime @default(now())
startTime DateTime?
finishTime DateTime?
manual Boolean @default(false) // If they were verified with the verify command
timedOut Boolean @default(false) // If they got kicked out of verification because they timed out
// complete Boolean @default(false) // If the verification was incomplete
// Roles they got from verification
vegan Boolean @default(false) // If they got verified as a vegan
activist Boolean @default(false) // If they got the activist role when they verified
trusted Boolean @default(false) // If they got the trusted role when they verified
vegCurious Boolean @default(false) // If they got the Veg Curious role
convinced Boolean @default(false)
text Boolean @default(false) // If they used text verification
serverVegan Boolean @default(false) // People that went vegan on the server
// Stats on verification
reason Int?
where Int?
length Int?
reasoning Int?
life Int?
food Int?
notes String?
}
model Event {
id Int @id @default(autoincrement())
type EventType @relation(fields: [eventType], references: [type])
eventType String
leader User @relation("eventLeader", fields: [leaderId], references: [id]) // Not sure if this will stay
leaderId String
startTime DateTime @default(now())
endTime DateTime?
stats Stat[]
}
model EventType {
type String @id
Event Event[]
}
model Stat {
id Int @id @default(autoincrement())
event Event @relation(fields: [eventId], references: [id])
eventId Int
leader User @relation("statLeader", fields: [leaderId], references: [id]) // Not sure if this will stay
leaderId String
vegan Int @default(0)
considered Int @default(0)
antivegan Int @default(0)
thanked Int @default(0)
documentary Int @default(0)
educated Int @default(0)
participationStats ParticipantStat[]
}
model ParticipantStat {
stat Stat @relation(fields: [statId], references: [id])
statId Int
user User @relation("participantUser", fields: [userId], references: [id])
userId String
@@id([statId, userId])
}
model Sus {
id Int @id @default(autoincrement())
user User @relation("susUser", fields: [userId], references: [id])
userId String
mod User @relation("susMod", fields: [modId], references: [id])
modId String
time DateTime @default(now())
active Boolean @default(true)
note String
}
model Warning {
id Int @id @default(autoincrement())
user User @relation("warnUser", fields: [userId], references: [id])
userId String
mod User @relation("warnMod", fields: [modId], references: [id])
modId String
time DateTime @default(now())
active Boolean @default(true)
note String
}
model Restrict {
id Int @id @default(autoincrement())
user User @relation("restUser", fields: [userId], references: [id])
userId String
mod User @relation("restMod", fields: [modId], references: [id])
modId String
startTime DateTime @default(now())
endMod User? @relation("endRestMod", fields: [endModId], references: [id])
endModId String?
endTime DateTime?
reason String
section Int
}
model Ban {
id Int @id @default(autoincrement())
user User @relation("banUser", fields: [userId], references: [id])
userId String
mod User @relation("banMod", fields: [modId], references: [id])
modId String
time DateTime @default(now())
endMod User? @relation("endBanMod", fields: [endModId], references: [id])
endModId String?
endTime DateTime?
active Boolean @default(true)
reason String
}
model TempBan {
id Int @id @default(autoincrement())
user User @relation("tbanUser", fields: [userId], references: [id])
userId String
mod User @relation("tbanMod", fields: [modId], references: [id])
modId String
startTime DateTime @default(now())
endMod User? @relation("endTbanMod", fields: [endModId], references: [id])
endModId String?
endTime DateTime
active Boolean @default(true)
reason String
}
model VCMute {
id Int @id @default(autoincrement())
user User @relation("vcMuteUser", fields: [userId], references: [id])
userId String
mod User @relation("vcMuteMod", fields: [modId], references: [id])
modId String
time DateTime @default(now())
endTime DateTime?
reason String?
}