mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 00:03:09 +02:00
Update schema
This commit is contained in:
parent
da7a2784ea
commit
aa0a265dbf
@ -8,10 +8,11 @@ datasource db {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model ArchivedChannel {
|
model ArchivedChannel {
|
||||||
channelId String @db.VarChar(19)
|
channelId String @db.VarChar(19)
|
||||||
|
createdAt DateTime @default(now())
|
||||||
name String
|
name String
|
||||||
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
||||||
ticketId String @db.VarChar(19)
|
ticketId String @db.VarChar(19)
|
||||||
|
|
||||||
@@id([ticketId, channelId])
|
@@id([ticketId, channelId])
|
||||||
@@unique([ticketId, channelId])
|
@@unique([ticketId, channelId])
|
||||||
@ -19,14 +20,15 @@ model ArchivedChannel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model ArchivedMessage {
|
model ArchivedMessage {
|
||||||
author ArchivedUser @relation(fields: [ticketId, authorId], references: [ticketId, userId])
|
author ArchivedUser @relation(fields: [ticketId, authorId], references: [ticketId, userId])
|
||||||
authorId String @db.VarChar(19)
|
authorId String @db.VarChar(19)
|
||||||
content String
|
content String
|
||||||
deleted Boolean @default(false)
|
createdAt DateTime @default(now())
|
||||||
edited Boolean @default(false)
|
deleted Boolean @default(false)
|
||||||
id String @id @db.VarChar(19)
|
edited Boolean @default(false)
|
||||||
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
id String @id @db.VarChar(19)
|
||||||
ticketId String @db.VarChar(19)
|
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
||||||
|
ticketId String @db.VarChar(19)
|
||||||
|
|
||||||
@@map("archivedMessages")
|
@@map("archivedMessages")
|
||||||
}
|
}
|
||||||
@ -34,6 +36,7 @@ model ArchivedMessage {
|
|||||||
model ArchivedRole {
|
model ArchivedRole {
|
||||||
archivedUsers ArchivedUser[]
|
archivedUsers ArchivedUser[]
|
||||||
colour String @default("7289DA") @db.Char(6)
|
colour String @default("7289DA") @db.Char(6)
|
||||||
|
createdAt DateTime @default(now())
|
||||||
name String
|
name String
|
||||||
roleId String @db.VarChar(19)
|
roleId String @db.VarChar(19)
|
||||||
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
||||||
@ -48,6 +51,7 @@ model ArchivedUser {
|
|||||||
archivedMessages ArchivedMessage[]
|
archivedMessages ArchivedMessage[]
|
||||||
avatar String
|
avatar String
|
||||||
bot Boolean @default(false)
|
bot Boolean @default(false)
|
||||||
|
createdAt DateTime @default(now())
|
||||||
discriminator String @db.Char(4)
|
discriminator String @db.Char(4)
|
||||||
displayName String
|
displayName String
|
||||||
role ArchivedRole @relation(fields: [ticketId, roleId], references: [ticketId, roleId])
|
role ArchivedRole @relation(fields: [ticketId, roleId], references: [ticketId, roleId])
|
||||||
@ -63,27 +67,26 @@ model ArchivedUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Category {
|
model Category {
|
||||||
channelName String @default("ticket-{num}")
|
channelName String @default("ticket-{num}")
|
||||||
claiming Boolean @default(false)
|
claiming Boolean @default(false)
|
||||||
description String
|
createdAt DateTime @default(now())
|
||||||
discordCategory String @db.VarChar(19)
|
description String
|
||||||
emoji String
|
discordCategory String @db.VarChar(19)
|
||||||
guild Guild @relation(fields: [guildId], references: [id])
|
emoji String
|
||||||
guildId String @db.VarChar(19)
|
guild Guild @relation(fields: [guildId], references: [id])
|
||||||
id Int @id @default(autoincrement())
|
guildId String @db.VarChar(19)
|
||||||
image String?
|
id Int @id @default(autoincrement())
|
||||||
memberLimit Int @default(1)
|
image String?
|
||||||
name String
|
memberLimit Int @default(1)
|
||||||
openingMessage String @db.Text
|
name String
|
||||||
pingRoles Json @default("[]")
|
openingMessage String @db.Text
|
||||||
requiredRoles Json
|
pingRoles Json @default("[]")
|
||||||
requireTopic Boolean @default(false)
|
questions Question[]
|
||||||
staffRoles Json
|
requiredRoles Json
|
||||||
surveyDescription String?
|
requireTopic Boolean @default(false)
|
||||||
surveyLink String?
|
staffRoles Json
|
||||||
surveyTitle String?
|
tickets Ticket[]
|
||||||
tickets Ticket[]
|
totalLimit Int @default(-1)
|
||||||
totalLimit Int @default(-1)
|
|
||||||
|
|
||||||
@@map("categories")
|
@@map("categories")
|
||||||
}
|
}
|
||||||
@ -92,8 +95,10 @@ model Guild {
|
|||||||
archive Boolean @default(true)
|
archive Boolean @default(true)
|
||||||
blocklist Json
|
blocklist Json
|
||||||
categories Category[]
|
categories Category[]
|
||||||
|
createdAt DateTime @default(now())
|
||||||
errorColour String @default("RED")
|
errorColour String @default("RED")
|
||||||
id String @id @db.VarChar(19)
|
id String @id @db.VarChar(19)
|
||||||
|
logChannel String? @db.VarChar(19)
|
||||||
primaryColour String @default("#009999")
|
primaryColour String @default("#009999")
|
||||||
successColour String @default("GREEN")
|
successColour String @default("GREEN")
|
||||||
tags Tag[]
|
tags Tag[]
|
||||||
@ -102,57 +107,100 @@ model Guild {
|
|||||||
@@map("guilds")
|
@@map("guilds")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model Question {
|
||||||
|
answers QuestionAnswer[]
|
||||||
|
id Int @id @default(autoincrement())
|
||||||
|
category Category? @relation(fields: [categoryId], references: [id])
|
||||||
|
categoryId Int?
|
||||||
|
maxLength Int @default(4000)
|
||||||
|
minLength Int @default(0)
|
||||||
|
order Int?
|
||||||
|
placeholder String? @db.VarChar(100)
|
||||||
|
required Boolean @default(true)
|
||||||
|
style Int @default(2)
|
||||||
|
value String? @db.VarChar(4000)
|
||||||
|
|
||||||
|
@@map("questions")
|
||||||
|
}
|
||||||
|
|
||||||
|
model QuestionAnswer {
|
||||||
|
id Int @id @default(autoincrement())
|
||||||
|
ticket Ticket @relation(fields: [ticketId], references: [id])
|
||||||
|
ticketId String @db.VarChar(19)
|
||||||
|
question Question @relation(fields: [questionId], references: [id])
|
||||||
|
questionId Int
|
||||||
|
user User @relation(fields: [userId], references: [id])
|
||||||
|
userId String @db.VarChar(19)
|
||||||
|
value String? @db.VarChar(4000)
|
||||||
|
|
||||||
|
@@map("questionAnswers")
|
||||||
|
}
|
||||||
|
|
||||||
model Tag {
|
model Tag {
|
||||||
content String
|
content String
|
||||||
guild Guild @relation(fields: [guildId], references: [id])
|
createdAt DateTime @default(now())
|
||||||
guildId String @db.VarChar(19)
|
guild Guild @relation(fields: [guildId], references: [id])
|
||||||
id Int @id @default(autoincrement())
|
guildId String @db.VarChar(19)
|
||||||
name String
|
id Int @id @default(autoincrement())
|
||||||
|
name String
|
||||||
|
regex String?
|
||||||
|
|
||||||
@@unique([guildId, name])
|
@@unique([guildId, name])
|
||||||
@@map("tags")
|
@@map("tags")
|
||||||
}
|
}
|
||||||
|
|
||||||
model Ticket {
|
model Ticket {
|
||||||
archivedChannels ArchivedChannel[]
|
archivedChannels ArchivedChannel[]
|
||||||
archivedMessages ArchivedMessage[]
|
archivedMessages ArchivedMessage[]
|
||||||
archivedRoles ArchivedRole[]
|
archivedRoles ArchivedRole[]
|
||||||
archivedUsers ArchivedUser[]
|
archivedUsers ArchivedUser[]
|
||||||
category Category? @relation(fields: [categoryId], references: [id], onDelete: SetNull)
|
category Category? @relation(fields: [categoryId], references: [id], onDelete: SetNull)
|
||||||
categoryId Int?
|
categoryId Int?
|
||||||
claimedBy User @relation(name: "TicketsClaimedByUser", fields: [claimedById], references: [id])
|
claimedBy User @relation(name: "TicketsClaimedByUser", fields: [claimedById], references: [id])
|
||||||
claimedById String @db.VarChar(19)
|
claimedById String @db.VarChar(19)
|
||||||
closedBy User @relation(name: "TicketsClosedByUser", fields: [closedById], references: [id])
|
closedBy User @relation(name: "TicketsClosedByUser", fields: [closedById], references: [id])
|
||||||
closedById String @db.VarChar(19)
|
closedById String @db.VarChar(19)
|
||||||
closedReason String?
|
closedReason String?
|
||||||
createdBy User @relation(name: "TicketsCreatedByUser", fields: [createdById], references: [id])
|
createdAt DateTime @default(now())
|
||||||
createdById String @db.VarChar(19)
|
createdBy User @relation(name: "TicketsCreatedByUser", fields: [createdById], references: [id])
|
||||||
firstResponse DateTime?
|
createdById String @db.VarChar(19)
|
||||||
deleted Boolean @default(false)
|
firstResponseAt DateTime?
|
||||||
guild Guild @relation(fields: [guildId], references: [id])
|
deleted Boolean @default(false)
|
||||||
guildId String @db.VarChar(19)
|
guild Guild @relation(fields: [guildId], references: [id])
|
||||||
id String @id @db.VarChar(19)
|
guildId String @db.VarChar(19)
|
||||||
lastMessage DateTime?
|
id String @id @db.VarChar(19)
|
||||||
messageCount Int?
|
lastMessageAt DateTime?
|
||||||
number Int
|
messageCount Int?
|
||||||
open Boolean @default(true)
|
number Int
|
||||||
openingMessage String @db.VarChar(19)
|
open Boolean @default(true)
|
||||||
pinnedMessages Json @default("[]")
|
openingMessage String @db.VarChar(19)
|
||||||
referencedBy Ticket[] @relation("TicketsReferencedByTicket")
|
pinnedMessages Json @default("[]")
|
||||||
references Ticket? @relation(name: "TicketsReferencedByTicket", fields: [referencesId], references: [id], onDelete: SetNull)
|
priority Priority?
|
||||||
referencesId String? @db.VarChar(19)
|
referencedBy Ticket[] @relation("TicketsReferencedByTicket")
|
||||||
topic String?
|
referencesMessageId String @db.VarChar(19)
|
||||||
|
referencesTicket Ticket? @relation(name: "TicketsReferencedByTicket", fields: [referencesTicketId], references: [id], onDelete: SetNull)
|
||||||
|
referencesTicketId String? @db.VarChar(19)
|
||||||
|
topic String?
|
||||||
|
questionAnswers QuestionAnswer[]
|
||||||
|
|
||||||
@@unique([guildId, number])
|
@@unique([guildId, number])
|
||||||
@@map("tickets")
|
@@map("tickets")
|
||||||
}
|
}
|
||||||
|
|
||||||
model User {
|
model User {
|
||||||
id String @id @db.VarChar(19)
|
createdAt DateTime @default(now())
|
||||||
messageCount Int @default(0)
|
id String @id @db.VarChar(19)
|
||||||
ticketsCreated Ticket[] @relation("TicketsCreatedByUser")
|
messageCount Int @default(0)
|
||||||
ticketsClosed Ticket[] @relation("TicketsClosedByUser")
|
ticketsCreated Ticket[] @relation("TicketsCreatedByUser")
|
||||||
ticketsClaimed Ticket[] @relation("TicketsClaimedByUser")
|
ticketsClosed Ticket[] @relation("TicketsClosedByUser")
|
||||||
|
ticketsClaimed Ticket[] @relation("TicketsClaimedByUser")
|
||||||
|
questionAnswers QuestionAnswer[]
|
||||||
|
|
||||||
@@map("users")
|
@@map("users")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum Priority {
|
||||||
|
LOW
|
||||||
|
MEDIUM
|
||||||
|
HIGH
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user