-- Phase 4: Pipeline tracking for batch eval jobs.
-- Tracks queued, running, and completed batch evaluations.

CREATE TABLE IF NOT EXISTS pipeline (
    id           INTEGER PRIMARY KEY,
    job_id       INTEGER NOT NULL REFERENCES jobs(id),
    queued_at    DATETIME DEFAULT CURRENT_TIMESTAMP,
    started_at   DATETIME,
    completed_at DATETIME
);

CREATE INDEX IF NOT EXISTS idx_pipeline_job ON pipeline(job_id);
CREATE INDEX IF NOT EXISTS idx_pipeline_completed ON pipeline(completed_at);
