feat(db): add warnings table

This commit is contained in:
smyalygames 2023-02-14 10:00:44 +00:00
parent 7dde12f456
commit 36bd0eb7a9
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,17 @@
-- CreateTable
CREATE TABLE "Warnings" (
"id" SERIAL NOT NULL,
"userId" TEXT NOT NULL,
"modId" TEXT NOT NULL,
"time" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"active" BOOLEAN NOT NULL DEFAULT true,
"note" TEXT NOT NULL,
CONSTRAINT "Warnings_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "Warnings" ADD CONSTRAINT "Warnings_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Warnings" ADD CONSTRAINT "Warnings_modId_fkey" FOREIGN KEY ("modId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -39,6 +39,8 @@ model User {
VerifyVerifier Verify[] @relation("verVerifier")
SusUser Sus[] @relation("susUser")
SusMod Sus[] @relation("susMod")
WarnUser Warnings[] @relation("warnUser")
WarnMod Warnings[] @relation("warnMod")
RestrictUser Restrict[] @relation("restUser")
RestrictMod Restrict[] @relation("restMod")
RestrictEndMod Restrict[] @relation("endRestMod")
@ -91,6 +93,17 @@ model Sus {
note String
}
model Warnings {
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])