CREATE TABLE IF NOT EXISTS ftest_job_states (
    name VARcHAR(20) NOT NULL UNIQUE,
    ID SERIAL PRIMARY KEY NOT NULL
);

CREATE TABLE IF NOT EXISTS ftest_jobs (
    commit_hash VARCHAR(40) NOT NULL UNIQUE,
    job_state  INTEGER references ftest_job_states(ID) ON DELETE CASCADE,
    auth VARCHAR(32) NOT NULL UNIQUE,
    created_at  timestamptz NOT NULL DEFAULT now(),
    scheduled_at timestamptz DEFAULT NULL,
    finished_at timestamptz DEFAULT NULL,
    ID SERIAL PRIMARY KEY NOT NULL
);
