-- ============================================================
-- Migration 066 (Phase 8.5d.2, 2026-04-29) — rewards_conditional + moral_choice_2
-- ============================================================
-- Permet aux missions narratives complexes (Hugues Phase 8.12, missions
-- hôpital H_01/02/03) d'avoir des récompenses conditionnées par 2 choix
-- moraux séquentiels (A_A, A_B, B_A, B_B).
--
-- Format JSON Mission.rewards_conditional :
--   {
--     "A_A": { "infinite_shadow": 4000, "axes": {...}, ... },
--     "A_B": { "infinite_shadow": 6000, ... },
--     "B_A": { "infinite_shadow": 0, ... },
--     "B_B": { "infinite_shadow": 2000, ... }
--   }
-- Si rewards_conditional est NULL → MissionService utilise rewards_success
-- (comportement legacy inchangé).
--
-- Idempotente : ADD COLUMN IF NOT EXISTS.
-- ============================================================

ALTER TABLE missions
  ADD COLUMN IF NOT EXISTS rewards_conditional jsonb;

ALTER TABLE mission_progress
  ADD COLUMN IF NOT EXISTS moral_choice_2 varchar(1);

-- ============================================================
-- Contrôle post-migration
-- ============================================================
-- SELECT column_name, data_type FROM information_schema.columns
--   WHERE table_name='missions' AND column_name='rewards_conditional';
-- SELECT column_name, data_type FROM information_schema.columns
--   WHERE table_name='mission_progress' AND column_name='moral_choice_2';
