alter table if exists search_rounds
  add column if not exists stage_started_at timestamptz,
  add column if not exists stage_ended_at timestamptz,
  add column if not exists stage_duration_ms integer,
  add column if not exists stage_status text not null default '';

create index if not exists idx_search_rounds_stage_timing
  on search_rounds(task_id, material_id, stage_order, stage_started_at);
