Move evaluation errors from evaluations to EvaluationErrors, a new table
DBIx likes to eagerly select all columns without a way to really tell it so. Therefore, this splits this one large column in to its own table. I'd also like to make "jobsets" use this table too, but that is on hold to stop the bleeding caused by the extreme amount of traffic this is causing.
This commit is contained in:
@ -437,13 +437,17 @@ create table SystemTypes (
|
||||
maxConcurrent integer not null default 2
|
||||
);
|
||||
|
||||
create table EvaluationErrors (
|
||||
id serial primary key not null,
|
||||
errorMsg text, -- error output from the evaluator
|
||||
errorTime integer -- timestamp associated with errorMsg
|
||||
);
|
||||
|
||||
create table JobsetEvals (
|
||||
id serial primary key not null,
|
||||
jobset_id integer not null,
|
||||
|
||||
errorMsg text, -- error output from the evaluator
|
||||
errorTime integer, -- timestamp associated with errorMsg
|
||||
evaluationerror_id integer,
|
||||
|
||||
timestamp integer not null, -- when this entry was added
|
||||
checkoutTime integer not null, -- how long obtaining the inputs took (in seconds)
|
||||
@ -471,7 +475,8 @@ create table JobsetEvals (
|
||||
nixExprInput text, -- name of the jobsetInput containing the Nix or Guix expression
|
||||
nixExprPath text, -- relative path of the Nix or Guix expression
|
||||
|
||||
foreign key (jobset_id) references Jobsets(id) on delete cascade
|
||||
foreign key (jobset_id) references Jobsets(id) on delete cascade,
|
||||
foreign key (evaluationerror_id) references EvaluationErrors(id) on delete set null
|
||||
);
|
||||
|
||||
|
||||
|
@ -21,6 +21,7 @@ make_schema_at("Hydra::Schema", {
|
||||
"cachedhginputs" => "CachedHgInputs",
|
||||
"cachedpathinputs" => "CachedPathInputs",
|
||||
"cachedsubversioninputs" => "CachedSubversionInputs",
|
||||
"evaluationerrors" => "EvaluationErrors",
|
||||
"failedpaths" => "FailedPaths",
|
||||
"jobsetevalinputs" => "JobsetEvalInputs",
|
||||
"jobsetevalmembers" => "JobsetEvalMembers",
|
||||
|
35
src/sql/upgrade-73.sql
Normal file
35
src/sql/upgrade-73.sql
Normal file
@ -0,0 +1,35 @@
|
||||
create table EvaluationErrors (
|
||||
id serial primary key not null,
|
||||
errorMsg text, -- error output from the evaluator
|
||||
errorTime integer, -- timestamp associated with errorMsg
|
||||
jobsetEvalId integer not null,
|
||||
|
||||
FOREIGN KEY (jobsetEvalId)
|
||||
REFERENCES JobsetEvals(id)
|
||||
ON DELETE SET NULL
|
||||
);
|
||||
|
||||
ALTER TABLE JobsetEvals
|
||||
ADD COLUMN evaluationerror_id integer NULL,
|
||||
ADD FOREIGN KEY (evaluationerror_id)
|
||||
REFERENCES EvaluationErrors(id)
|
||||
ON DELETE SET NULL;
|
||||
|
||||
INSERT INTO EvaluationErrors
|
||||
(errorMsg, errorTime, jobsetEvalId)
|
||||
SELECT errorMsg, errorTime, id
|
||||
FROM JobsetEvals
|
||||
WHERE JobsetEvals.errorMsg != '' and JobsetEvals.errorMsg is not null;
|
||||
|
||||
UPDATE JobsetEvals
|
||||
SET evaluationerror_id = EvaluationErrors.id
|
||||
FROM EvaluationErrors
|
||||
WHERE JobsetEvals.id = EvaluationErrors.jobsetEvalId
|
||||
AND JobsetEvals.errorMsg != '' and JobsetEvals.errorMsg is not null;
|
||||
|
||||
ALTER TABLE JobsetEvals
|
||||
DROP COLUMN errorMsg,
|
||||
DROP COLUMN errorTime;
|
||||
|
||||
ALTER TABLE EvaluationErrors
|
||||
DROP COLUMN jobsetEvalId;
|
Reference in New Issue
Block a user