From b14de4793417881e771259301f2bd710c869fb3c Mon Sep 17 00:00:00 2001 From: smyalygames Date: Sat, 11 Feb 2023 00:35:35 +0000 Subject: [PATCH] feat(db): add vcmute database --- .../20230211001033_vcmute/migration.sql | 17 +++++++++++++++++ prisma/schema.prisma | 13 +++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 prisma/migrations/20230211001033_vcmute/migration.sql diff --git a/prisma/migrations/20230211001033_vcmute/migration.sql b/prisma/migrations/20230211001033_vcmute/migration.sql new file mode 100644 index 0000000..fe45f2f --- /dev/null +++ b/prisma/migrations/20230211001033_vcmute/migration.sql @@ -0,0 +1,17 @@ +-- CreateTable +CREATE TABLE "VCMute" ( + "id" SERIAL NOT NULL, + "userId" TEXT NOT NULL, + "modId" TEXT NOT NULL, + "time" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "endTime" TIMESTAMP(3), + "reason" TEXT, + + CONSTRAINT "VCMute_pkey" PRIMARY KEY ("id") +); + +-- AddForeignKey +ALTER TABLE "VCMute" ADD CONSTRAINT "VCMute_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "VCMute" ADD CONSTRAINT "VCMute_modId_fkey" FOREIGN KEY ("modId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 129ad31..1c3dfa3 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -46,6 +46,8 @@ model User { BanEndMod Ban[] @relation("endBanMod") TempBanUser TempBan[] @relation("tbanUser") TempBanMod TempBan[] @relation("tbanMod") + VCMuteUser VCMute[] @relation("vcMuteUser") + VCMuteMod VCMute[] @relation("vcMuteMod") } model Verify { @@ -124,3 +126,14 @@ model TempBan { 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? +}