ALTER TABLE audio_segments
  ADD COLUMN transcription_attempts INTEGER NOT NULL DEFAULT 0
    CHECK (transcription_attempts >= 0),
  ADD COLUMN processing_started_at TIMESTAMPTZ;

CREATE INDEX audio_segments_processing_queue_idx
  ON audio_segments (created_at, id)
  WHERE status = 'processing';
