From 3d53b2c95ac004102dc2487f56c9c836188955bd Mon Sep 17 00:00:00 2001 From: Martin Mares <mj@ucw.cz> Date: Mon, 11 Jan 2021 14:59:15 +0100 Subject: [PATCH] =?UTF-8?q?DB:=20Upgrade=20zakl=C3=A1d=C3=A1=20tabulku=20j?= =?UTF-8?q?obs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/upgrade-20210111.sql | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/db/upgrade-20210111.sql b/db/upgrade-20210111.sql index c41d51a2..78ee9b8c 100644 --- a/db/upgrade-20210111.sql +++ b/db/upgrade-20210111.sql @@ -26,3 +26,31 @@ ALTER TABLE papers ALTER TABLE solutions RENAME COLUMN last_submit TO final_submit, RENAME COLUMN last_feedback TO final_feedback; + +CREATE TYPE job_type AS ENUM ( + 'download_submits', + 'upload_feedback' +); + +CREATE TYPE job_state AS ENUM ( + 'ready', + 'running', + 'done', -- Hotovo, out_json a out_file jsou platné + 'failed' -- Interní chyba při zpracování, viz log +); + +CREATE TABLE jobs ( + job_id serial PRIMARY KEY, + type job_type NOT NULL, + state job_state NOT NULL, + user_id int NOT NULL REFERENCES users(user_id), -- komu patří + created_at timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, -- kdy byl založen + finished_at timestamp with time zone DEFAULT NULL, -- kdy doběhl + expires_at timestamp with time zone DEFAULT NULL, -- kdy bude automaticky smazán + description text NOT NULL DEFAULT '', + in_json jsonb DEFAULT NULL, + out_json jsonb DEFAULT NULL, + -- Soubory jsou součástí úlohy a po jejím ukončení budou smazány + in_file varchar(255) DEFAULT NULL, + out_file varchar(255) DEFAULT NULL +); -- GitLab