-- Add persistent next-task selection for case todo steps ALTER TABLE sag_todo_steps ADD COLUMN IF NOT EXISTS is_next BOOLEAN NOT NULL DEFAULT FALSE; CREATE INDEX IF NOT EXISTS idx_sag_todo_steps_is_next ON sag_todo_steps (sag_id, is_next);