This commit is contained in:
2025-07-19 12:21:46 +02:00
parent 12822dfdbf
commit 2e7957d0a0
86 changed files with 25573 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
/*
Warnings:
- You are about to drop the column `player1Id` on the `Match` table. All the data in the column will be lost.
- You are about to drop the column `player2Id` on the `Match` table. All the data in the column will be lost.
- You are about to drop the column `player1Score` on the `Result` table. All the data in the column will be lost.
- You are about to drop the column `player2Score` on the `Result` table. All the data in the column will be lost.
- Added the required column `team1Id` to the `Match` table without a default value. This is not possible if the table is not empty.
- Added the required column `team2Id` to the `Match` table without a default value. This is not possible if the table is not empty.
- Added the required column `team1Score` to the `Result` table without a default value. This is not possible if the table is not empty.
- Added the required column `team2Score` to the `Result` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "Match" DROP CONSTRAINT "Match_player1Id_fkey";
-- DropForeignKey
ALTER TABLE "Match" DROP CONSTRAINT "Match_player2Id_fkey";
-- DropForeignKey
ALTER TABLE "Result" DROP CONSTRAINT "Result_winnerId_fkey";
-- AlterTable
ALTER TABLE "Match" DROP COLUMN "player1Id",
DROP COLUMN "player2Id",
ADD COLUMN "team1Id" INTEGER NOT NULL,
ADD COLUMN "team2Id" INTEGER NOT NULL;
-- AlterTable
ALTER TABLE "Player" ADD COLUMN "teamId" INTEGER;
-- AlterTable
ALTER TABLE "Result" DROP COLUMN "player1Score",
DROP COLUMN "player2Score",
ADD COLUMN "team1Score" INTEGER NOT NULL,
ADD COLUMN "team2Score" INTEGER NOT NULL;
-- CreateTable
CREATE TABLE "Team" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"registeredAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Team_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Team_name_key" ON "Team"("name");
-- AddForeignKey
ALTER TABLE "Player" ADD CONSTRAINT "Player_teamId_fkey" FOREIGN KEY ("teamId") REFERENCES "Team"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Match" ADD CONSTRAINT "Match_team1Id_fkey" FOREIGN KEY ("team1Id") REFERENCES "Team"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Match" ADD CONSTRAINT "Match_team2Id_fkey" FOREIGN KEY ("team2Id") REFERENCES "Team"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Result" ADD CONSTRAINT "Result_winnerId_fkey" FOREIGN KEY ("winnerId") REFERENCES "Team"("id") ON DELETE RESTRICT ON UPDATE CASCADE;