-- =============================================================================
-- Phase 7/8 Migration Part 2: Drop legacy Pipeline/Track/Stage tables and enums
-- =============================================================================
-- This migration removes the old stage-based architecture tables and enums.
-- All data has been migrated to Competition/Round architecture.

-- ─── Drop Tables in FK-safe order ────────────────────────────────────────────

-- Drop ProjectStageState (references Track and Stage)
DROP TABLE IF EXISTS "ProjectStageState" CASCADE;

-- Drop StageTransition (references Stage)
DROP TABLE IF EXISTS "StageTransition" CASCADE;

-- Drop Stage (references Track)
DROP TABLE IF EXISTS "Stage" CASCADE;

-- Drop Track (references Pipeline)
DROP TABLE IF EXISTS "Track" CASCADE;

-- Drop Pipeline
DROP TABLE IF EXISTS "Pipeline" CASCADE;

-- ─── Drop Enums ──────────────────────────────────────────────────────────────

DROP TYPE IF EXISTS "StageType";
DROP TYPE IF EXISTS "TrackKind";
DROP TYPE IF EXISTS "RoutingMode";
DROP TYPE IF EXISTS "StageStatus";
DROP TYPE IF EXISTS "ProjectStageStateValue";
DROP TYPE IF EXISTS "DecisionMode";
