Schema: add errorMsg, errorTime to JobsetEvals

This commit is contained in:
Graham Christensen
2021-01-21 09:36:57 -05:00
parent 6bb876cb35
commit d9989b7fa1
3 changed files with 53 additions and 2 deletions

View File

@ -440,6 +440,9 @@ create table JobsetEvals (
project text not null,
jobset text not null,
errorMsg text, -- error output from the evaluator
errorTime integer, -- timestamp associated with errorMsg
timestamp integer not null, -- when this entry was added
checkoutTime integer not null, -- how long obtaining the inputs took (in seconds)
evalTime integer not null, -- how long evaluation took (in seconds)

34
src/sql/upgrade-70.sql Normal file
View File

@ -0,0 +1,34 @@
ALTER TABLE JobsetEvals
ADD COLUMN errorMsg text,
ADD COLUMN errorTime integer NULL;
-- Copy the current error in jobsets to the latest field in jobsetevals
UPDATE jobsetevals
SET errorMsg = j.errorMsg,
errorTime = j.errorTime
FROM (
SELECT
jobsets.errorMsg,
jobsets.errorTime,
jobsets.id AS jobset_id,
latesteval.id AS eval_id
FROM jobsets
LEFT JOIN
(
SELECT
MAX(id) AS id,
project,
jobset
FROM jobsetevals
GROUP BY project, jobset
ORDER BY project, jobset
)
AS latesteval
ON
jobsets.name = latesteval.jobset
AND jobsets.project = latesteval.project
WHERE latesteval.id IS NOT NULL
ORDER BY jobsets.id
)
AS j
WHERE id = j.eval_id;