CREATE TABLE job (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    created TIMESTAMPTZ NOT NULL,
    modified TIMESTAMPTZ,
    state VARCHAR(64) NOT NULL,
    job_key VARCHAR(255) NOT NULL,
    payload JSONB NOT NULL,
    attempts INT NOT NULL,
    max_attempts INT NOT NULL,
    run_after TIMESTAMPTZ NOT NULL,
    locked_by VARCHAR(255),
    locked_at TIMESTAMPTZ,
    last_error TEXT
);