-- Modify BetPrediction enum to use simple prediction types
-- First, create a temporary enum with new values
CREATE TYPE "BetPrediction_new" AS ENUM ('HOME', 'DRAW', 'AWAY', 'EXACT_SCORE');

-- Modify bets table: remove amount, odds, potentialPayout and add pointsWon
ALTER TABLE "bets" DROP COLUMN IF EXISTS "amount";
ALTER TABLE "bets" DROP COLUMN IF EXISTS "odds";
ALTER TABLE "bets" DROP COLUMN IF EXISTS "potentialPayout";
ALTER TABLE "bets" ADD COLUMN "pointsWon" INTEGER NOT NULL DEFAULT 0;

-- Update prediction column to use new enum values
ALTER TABLE "bets" ALTER COLUMN "prediction" TYPE "BetPrediction_new" USING (
  CASE prediction::text
    WHEN 'HOME_WIN' THEN 'HOME'
    WHEN 'AWAY_WIN' THEN 'AWAY'
    ELSE prediction::text
  END::"BetPrediction_new"
);

-- Drop old enum and rename new one
DROP TYPE "BetPrediction";
ALTER TYPE "BetPrediction_new" RENAME TO "BetPrediction";
