jobsetevals: refer to jobset by ID
This commit is contained in:
@ -440,9 +440,7 @@ create table SystemTypes (
|
||||
|
||||
create table JobsetEvals (
|
||||
id serial primary key not null,
|
||||
|
||||
project text not null,
|
||||
jobset text not null,
|
||||
jobset_id integer not null,
|
||||
|
||||
errorMsg text, -- error output from the evaluator
|
||||
errorTime integer, -- timestamp associated with errorMsg
|
||||
@ -473,8 +471,7 @@ 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 (project) references Projects(name) on delete cascade on update cascade,
|
||||
foreign key (project, jobset) references Jobsets(project, name) on delete cascade on update cascade
|
||||
foreign key (jobset_id) references Jobsets(id) on delete cascade
|
||||
);
|
||||
|
||||
|
||||
@ -629,7 +626,8 @@ create index IndexBuildOutputsPath on BuildOutputs using hash(path);
|
||||
create index IndexBuildsOnKeep on Builds(keep) where keep = 1;
|
||||
|
||||
-- To get the most recent eval for a jobset.
|
||||
create index IndexJobsetEvalsOnJobsetId on JobsetEvals(project, jobset, id desc) where hasNewBuilds = 1;
|
||||
create index IndexJobsetEvalsOnJobsetId on JobsetEvals(jobset_id, id desc) where hasNewBuilds = 1;
|
||||
create index IndexJobsetIdEvals on JobsetEvals(jobset_id) where hasNewBuilds = 1;
|
||||
|
||||
create index IndexBuildsOnNotificationPendingSince on Builds(notificationPendingSince) where notificationPendingSince is not null;
|
||||
|
||||
|
22
src/sql/upgrade-72.sql
Normal file
22
src/sql/upgrade-72.sql
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
ALTER TABLE JobsetEvals
|
||||
ADD COLUMN jobset_id integer NULL,
|
||||
ADD FOREIGN KEY (jobset_id)
|
||||
REFERENCES Jobsets(id)
|
||||
ON DELETE CASCADE;
|
||||
|
||||
UPDATE JobsetEvals
|
||||
SET jobset_id = (
|
||||
SELECT jobsets.id
|
||||
FROM jobsets
|
||||
WHERE jobsets.name = JobsetEvals.jobset
|
||||
AND jobsets.project = JobsetEvals.project
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE JobsetEvals
|
||||
ALTER COLUMN jobset_id SET NOT NULL,
|
||||
DROP COLUMN jobset,
|
||||
DROP COLUMN project;
|
||||
|
||||
create index IndexJobsetIdEvals on JobsetEvals(jobset_id) where hasNewBuilds = 1;
|
Reference in New Issue
Block a user