mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-06-28 06:34:15 +00:00
feat: user lookup and user punishments in admin panel
need to work on actually punishing the user
This commit is contained in:
parent
0c7be71b2c
commit
e195d2e80b
7 changed files with 534 additions and 7 deletions
36
prisma/migrations/20250524155917_punishments/migration.sql
Normal file
36
prisma/migrations/20250524155917_punishments/migration.sql
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
-- CreateEnum
|
||||
CREATE TYPE "PunishmentType" AS ENUM ('WARNING', 'TEMP_EXILE', 'PERM_EXILE');
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "miis" ADD COLUMN "punishmentId" INTEGER;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "mii_punishments" (
|
||||
"punishmentId" INTEGER NOT NULL,
|
||||
"miiId" INTEGER NOT NULL,
|
||||
"reason" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "mii_punishments_pkey" PRIMARY KEY ("punishmentId","miiId")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "punishments" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"userId" INTEGER NOT NULL,
|
||||
"type" "PunishmentType" NOT NULL,
|
||||
"notes" TEXT NOT NULL,
|
||||
"reasons" TEXT[],
|
||||
"expiresAt" TIMESTAMP(3),
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "punishments_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "mii_punishments" ADD CONSTRAINT "mii_punishments_punishmentId_fkey" FOREIGN KEY ("punishmentId") REFERENCES "punishments"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "mii_punishments" ADD CONSTRAINT "mii_punishments_miiId_fkey" FOREIGN KEY ("miiId") REFERENCES "miis"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "punishments" ADD CONSTRAINT "punishments_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
Loading…
Add table
Add a link
Reference in a new issue