Files
temfut/prisma/migrations/20260121031920_add_attendance_system/migration.sql

25 lines
886 B
SQL

-- AlterTable
ALTER TABLE "Match" ADD COLUMN "drawSeed" TEXT,
ADD COLUMN "location" TEXT,
ADD COLUMN "maxPlayers" INTEGER;
-- CreateTable
CREATE TABLE "Attendance" (
"id" TEXT NOT NULL,
"playerId" TEXT NOT NULL,
"matchId" TEXT NOT NULL,
"status" TEXT NOT NULL DEFAULT 'CONFIRMED',
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Attendance_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Attendance_playerId_matchId_key" ON "Attendance"("playerId", "matchId");
-- AddForeignKey
ALTER TABLE "Attendance" ADD CONSTRAINT "Attendance_playerId_fkey" FOREIGN KEY ("playerId") REFERENCES "Player"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Attendance" ADD CONSTRAINT "Attendance_matchId_fkey" FOREIGN KEY ("matchId") REFERENCES "Match"("id") ON DELETE RESTRICT ON UPDATE CASCADE;