CREATE TYPE job_status AS ENUM ('running', 'completed', 'failed');

CREATE TABLE jobs (
    id UUID PRIMARY KEY,
    status job_status NOT NULL DEFAULT 'running',
    error TEXT,
    result BYTEA,
    expires_at TIMESTAMP WITH TIME ZONE NOT NULL
);

CREATE INDEX idx_jobs_status ON jobs(status);
CREATE INDEX idx_jobs_expires_at ON jobs(expires_at);
