ALTER TABLE tracked_plan
    ADD COLUMN IF NOT EXISTS plan_source VARCHAR(64) NOT NULL DEFAULT 'AUTO_CHAIN',
    ADD COLUMN IF NOT EXISTS base_plan_id UUID,
    ADD COLUMN IF NOT EXISTS superseded_by_plan_id UUID;

CREATE INDEX IF NOT EXISTS idx_tracked_plan_base_plan_id ON tracked_plan(base_plan_id);
CREATE INDEX IF NOT EXISTS idx_tracked_plan_superseded_by_plan_id ON tracked_plan(superseded_by_plan_id);
