-- Phase 1 / Migration 2
-- Additive columns for rm_forecast_accuracy_v2
-- Pre-check:
-- SELECT column_name FROM information_schema.columns
-- WHERE table_name = 'rm_forecast_accuracy_v2'
--   AND column_name IN ('event_date','home_score','away_score','winner_score','is_preseason',
--                       'original_forecast','benchmark_forecast','closing_market','final_grade',
--                       'grading_policy','forecast_type','benchmark_source');
-- Post-check:
-- SELECT column_name, data_type, column_default FROM information_schema.columns
-- WHERE table_name = 'rm_forecast_accuracy_v2'
--   AND column_name IN ('event_date','home_score','away_score','winner_score','is_preseason',
--                       'original_forecast','benchmark_forecast','closing_market','final_grade',
--                       'grading_policy','forecast_type','benchmark_source');
-- Rollback:
-- ALTER TABLE rm_forecast_accuracy_v2
--   DROP COLUMN IF EXISTS event_date,
--   DROP COLUMN IF EXISTS home_score,
--   DROP COLUMN IF EXISTS away_score,
--   DROP COLUMN IF EXISTS winner_score,
--   DROP COLUMN IF EXISTS is_preseason,
--   DROP COLUMN IF EXISTS original_forecast,
--   DROP COLUMN IF EXISTS benchmark_forecast,
--   DROP COLUMN IF EXISTS closing_market,
--   DROP COLUMN IF EXISTS final_grade,
--   DROP COLUMN IF EXISTS grading_policy,
--   DROP COLUMN IF EXISTS forecast_type,
--   DROP COLUMN IF EXISTS benchmark_source;

ALTER TABLE rm_forecast_accuracy_v2
  ADD COLUMN IF NOT EXISTS event_date date,
  ADD COLUMN IF NOT EXISTS home_score integer,
  ADD COLUMN IF NOT EXISTS away_score integer,
  ADD COLUMN IF NOT EXISTS winner_score text,
  ADD COLUMN IF NOT EXISTS is_preseason boolean DEFAULT false,
  ADD COLUMN IF NOT EXISTS original_forecast double precision,
  ADD COLUMN IF NOT EXISTS benchmark_forecast double precision,
  ADD COLUMN IF NOT EXISTS closing_market double precision,
  ADD COLUMN IF NOT EXISTS final_grade varchar(1),
  ADD COLUMN IF NOT EXISTS grading_policy varchar(50),
  ADD COLUMN IF NOT EXISTS forecast_type varchar(20),
  ADD COLUMN IF NOT EXISTS benchmark_source varchar(20);
