mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-11-05 12:23:09 +02:00
57f9628469
to maintain accurate stats after archived messages are deleted
158 lines
5.5 KiB
Plaintext
158 lines
5.5 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "mysql"
|
|
url = env("DB_CONNECTION_URL")
|
|
}
|
|
|
|
model ArchivedChannel {
|
|
channelId String @db.VarChar(19)
|
|
name String
|
|
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
|
ticketId String @db.VarChar(19)
|
|
|
|
@@id([ticketId, channelId])
|
|
@@unique([ticketId, channelId])
|
|
@@map("archivedChannels")
|
|
}
|
|
|
|
model ArchivedMessage {
|
|
author ArchivedUser @relation(fields: [ticketId, authorId], references: [ticketId, userId])
|
|
authorId String @db.VarChar(19)
|
|
content String
|
|
deleted Boolean @default(false)
|
|
edited Boolean @default(false)
|
|
id String @id @db.VarChar(19)
|
|
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
|
ticketId String @db.VarChar(19)
|
|
|
|
@@map("archivedMessages")
|
|
}
|
|
|
|
model ArchivedRole {
|
|
archivedUsers ArchivedUser[]
|
|
colour String @default("7289DA") @db.Char(6)
|
|
name String
|
|
roleId String @db.VarChar(19)
|
|
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
|
ticketId String @db.VarChar(19)
|
|
|
|
@@id([ticketId, roleId])
|
|
@@unique([ticketId, roleId])
|
|
@@map("archivedRoles")
|
|
}
|
|
|
|
model ArchivedUser {
|
|
archivedMessages ArchivedMessage[]
|
|
avatar String
|
|
bot Boolean @default(false)
|
|
discriminator String @db.Char(4)
|
|
displayName String
|
|
role ArchivedRole @relation(fields: [ticketId, roleId], references: [ticketId, roleId])
|
|
roleId String @db.VarChar(19)
|
|
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
|
ticketId String @db.VarChar(19)
|
|
userId String @db.VarChar(19)
|
|
username String
|
|
|
|
@@id([ticketId, userId])
|
|
@@unique([ticketId, userId])
|
|
@@map("archivedUsers")
|
|
}
|
|
|
|
model Category {
|
|
channelName String @default("ticket-{num}")
|
|
claiming Boolean @default(false)
|
|
description String
|
|
discordCategory String @db.VarChar(19)
|
|
emoji String
|
|
guild Guild @relation(fields: [guildId], references: [id])
|
|
guildId String @db.VarChar(19)
|
|
id Int @id @default(autoincrement())
|
|
image String?
|
|
memberLimit Int @default(1)
|
|
name String
|
|
openingMessage String @db.Text
|
|
pingRoles Json @default("[]")
|
|
requiredRoles Json
|
|
requireTopic Boolean @default(false)
|
|
staffRoles Json
|
|
surveyDescription String?
|
|
surveyLink String?
|
|
surveyTitle String?
|
|
tickets Ticket[]
|
|
totalLimit Int @default(-1)
|
|
|
|
@@map("categories")
|
|
}
|
|
|
|
model Guild {
|
|
archive Boolean @default(true)
|
|
blocklist Json
|
|
categories Category[]
|
|
errorColour String @default("RED")
|
|
id String @id @db.VarChar(19)
|
|
primaryColour String @default("#009999")
|
|
successColour String @default("GREEN")
|
|
tags Tag[]
|
|
tickets Ticket[]
|
|
|
|
@@map("guilds")
|
|
}
|
|
|
|
model Tag {
|
|
content String
|
|
guild Guild @relation(fields: [guildId], references: [id])
|
|
guildId String @db.VarChar(19)
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
|
|
@@unique([guildId, name])
|
|
@@map("tags")
|
|
}
|
|
|
|
model Ticket {
|
|
archivedChannels ArchivedChannel[]
|
|
archivedMessages ArchivedMessage[]
|
|
archivedRoles ArchivedRole[]
|
|
archivedUsers ArchivedUser[]
|
|
category Category? @relation(fields: [categoryId], references: [id], onDelete: SetNull)
|
|
categoryId Int?
|
|
claimedBy User @relation(name: "TicketsClaimedByUser", fields: [claimedById], references: [id])
|
|
claimedById String @db.VarChar(19)
|
|
closedBy User @relation(name: "TicketsClosedByUser", fields: [closedById], references: [id])
|
|
closedById String @db.VarChar(19)
|
|
closedReason String?
|
|
createdBy User @relation(name: "TicketsCreatedByUser", fields: [createdById], references: [id])
|
|
createdById String @db.VarChar(19)
|
|
firstResponse DateTime?
|
|
deleted Boolean @default(false)
|
|
guild Guild @relation(fields: [guildId], references: [id])
|
|
guildId String @db.VarChar(19)
|
|
id String @id @db.VarChar(19)
|
|
lastMessage DateTime?
|
|
messageCount Int?
|
|
number Int
|
|
open Boolean @default(true)
|
|
openingMessage String @db.VarChar(19)
|
|
pinnedMessages Json @default("[]")
|
|
referencedBy Ticket[] @relation("TicketsReferencedByTicket")
|
|
references Ticket? @relation(name: "TicketsReferencedByTicket", fields: [referencesId], references: [id], onDelete: SetNull)
|
|
referencesId String? @db.VarChar(19)
|
|
topic String?
|
|
|
|
@@unique([guildId, number])
|
|
@@map("tickets")
|
|
}
|
|
|
|
model User {
|
|
id String @id @db.VarChar(19)
|
|
ticketsCreated Ticket[] @relation("TicketsCreatedByUser")
|
|
ticketsClosed Ticket[] @relation("TicketsClosedByUser")
|
|
ticketsClaimed Ticket[] @relation("TicketsClaimedByUser")
|
|
|
|
@@map("users")
|
|
}
|