/*
  Warnings:

  - You are about to drop the column `home_team_id` on the `Points` table. All the data in the column will be lost.
  - You are about to drop the column `loser_id` on the `Points` table. All the data in the column will be lost.
  - You are about to drop the column `points` on the `Points` table. All the data in the column will be lost.
  - You are about to drop the column `visitors_team_id` on the `Points` table. All the data in the column will be lost.
  - You are about to drop the column `winner_id` on the `Points` table. All the data in the column will be lost.
  - Added the required column `points_score` to the `Points` table without a default value. This is not possible if the table is not empty.
  - Added the required column `points_team` to the `Points` table without a default value. This is not possible if the table is not empty.

*/
-- DropForeignKey
ALTER TABLE "Points" DROP CONSTRAINT "Points_home_team_id_fkey";

-- DropForeignKey
ALTER TABLE "Points" DROP CONSTRAINT "Points_loser_id_fkey";

-- DropForeignKey
ALTER TABLE "Points" DROP CONSTRAINT "Points_visitors_team_id_fkey";

-- DropForeignKey
ALTER TABLE "Points" DROP CONSTRAINT "Points_winner_id_fkey";

-- AlterTable
ALTER TABLE "Matches" ADD COLUMN     "match_loser" INTEGER,
ADD COLUMN     "match_winner" INTEGER;

-- AlterTable
ALTER TABLE "Points" DROP COLUMN "home_team_id",
DROP COLUMN "loser_id",
DROP COLUMN "points",
DROP COLUMN "visitors_team_id",
DROP COLUMN "winner_id",
ADD COLUMN     "points_score" INTEGER NOT NULL,
ADD COLUMN     "points_team" INTEGER NOT NULL;

-- AddForeignKey
ALTER TABLE "Matches" ADD CONSTRAINT "Matches_match_winner_fkey" FOREIGN KEY ("match_winner") REFERENCES "teams"("team_id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Matches" ADD CONSTRAINT "Matches_match_loser_fkey" FOREIGN KEY ("match_loser") REFERENCES "teams"("team_id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Points" ADD CONSTRAINT "Points_points_team_fkey" FOREIGN KEY ("points_team") REFERENCES "teams"("team_id") ON DELETE RESTRICT ON UPDATE CASCADE;
