/*
  Warnings:

  - You are about to drop the `Foals` table. If the table is not empty, all the data it contains will be lost.

*/
-- DropForeignKey
ALTER TABLE "Foals" DROP CONSTRAINT "Foals_foul_player_id_fkey";

-- DropForeignKey
ALTER TABLE "Foals" DROP CONSTRAINT "Foals_foul_team_id_fkey";

-- DropForeignKey
ALTER TABLE "Foals" DROP CONSTRAINT "Foals_match_id_fkey";

-- DropTable
DROP TABLE "Foals";

-- CreateTable
CREATE TABLE "Fouls" (
    "foul_id" SERIAL NOT NULL,
    "match_id" INTEGER NOT NULL,
    "foul_team_id" INTEGER NOT NULL,
    "foul_player_id" INTEGER NOT NULL,
    "foul_description" TEXT NOT NULL,
    "foul_card" "FoulCard" NOT NULL,
    "foul_time" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

    CONSTRAINT "Fouls_pkey" PRIMARY KEY ("foul_id")
);

-- AddForeignKey
ALTER TABLE "Fouls" ADD CONSTRAINT "Fouls_match_id_fkey" FOREIGN KEY ("match_id") REFERENCES "Matches"("match_id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Fouls" ADD CONSTRAINT "Fouls_foul_team_id_fkey" FOREIGN KEY ("foul_team_id") REFERENCES "teams"("team_id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Fouls" ADD CONSTRAINT "Fouls_foul_player_id_fkey" FOREIGN KEY ("foul_player_id") REFERENCES "users"("user_id") ON DELETE RESTRICT ON UPDATE CASCADE;
