jobsetevals: refer to jobset by ID
This commit is contained in:
parent
99e3c83358
commit
ac3e8a4a59
|
@ -42,15 +42,9 @@ __PACKAGE__->table("jobsetevals");
|
||||||
is_nullable: 0
|
is_nullable: 0
|
||||||
sequence: 'jobsetevals_id_seq'
|
sequence: 'jobsetevals_id_seq'
|
||||||
|
|
||||||
=head2 project
|
=head2 jobset_id
|
||||||
|
|
||||||
data_type: 'text'
|
data_type: 'integer'
|
||||||
is_foreign_key: 1
|
|
||||||
is_nullable: 0
|
|
||||||
|
|
||||||
=head2 jobset
|
|
||||||
|
|
||||||
data_type: 'text'
|
|
||||||
is_foreign_key: 1
|
is_foreign_key: 1
|
||||||
is_nullable: 0
|
is_nullable: 0
|
||||||
|
|
||||||
|
@ -124,10 +118,8 @@ __PACKAGE__->add_columns(
|
||||||
is_nullable => 0,
|
is_nullable => 0,
|
||||||
sequence => "jobsetevals_id_seq",
|
sequence => "jobsetevals_id_seq",
|
||||||
},
|
},
|
||||||
"project",
|
"jobset_id",
|
||||||
{ data_type => "text", is_foreign_key => 1, is_nullable => 0 },
|
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
|
||||||
"jobset",
|
|
||||||
{ data_type => "text", is_foreign_key => 1, is_nullable => 0 },
|
|
||||||
"errormsg",
|
"errormsg",
|
||||||
{ data_type => "text", is_nullable => 1 },
|
{ data_type => "text", is_nullable => 1 },
|
||||||
"errortime",
|
"errortime",
|
||||||
|
@ -179,8 +171,8 @@ Related object: L<Hydra::Schema::Jobsets>
|
||||||
__PACKAGE__->belongs_to(
|
__PACKAGE__->belongs_to(
|
||||||
"jobset",
|
"jobset",
|
||||||
"Hydra::Schema::Jobsets",
|
"Hydra::Schema::Jobsets",
|
||||||
{ name => "jobset", project => "project" },
|
{ id => "jobset_id" },
|
||||||
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
|
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
|
||||||
);
|
);
|
||||||
|
|
||||||
=head2 jobsetevalinputs
|
=head2 jobsetevalinputs
|
||||||
|
@ -213,24 +205,9 @@ __PACKAGE__->has_many(
|
||||||
undef,
|
undef,
|
||||||
);
|
);
|
||||||
|
|
||||||
=head2 project
|
|
||||||
|
|
||||||
Type: belongs_to
|
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-25 14:44:07
|
||||||
|
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OVxeYH+eoZZrAsAJ2/mAAA
|
||||||
Related object: L<Hydra::Schema::Projects>
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
__PACKAGE__->belongs_to(
|
|
||||||
"project",
|
|
||||||
"Hydra::Schema::Projects",
|
|
||||||
{ name => "project" },
|
|
||||||
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-25 14:43:28
|
|
||||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VKQNG53wwdbO8p1CTdX+WA
|
|
||||||
|
|
||||||
__PACKAGE__->has_many(
|
__PACKAGE__->has_many(
|
||||||
"buildIds",
|
"buildIds",
|
||||||
|
|
|
@ -301,10 +301,7 @@ Related object: L<Hydra::Schema::JobsetEvals>
|
||||||
__PACKAGE__->has_many(
|
__PACKAGE__->has_many(
|
||||||
"jobsetevals",
|
"jobsetevals",
|
||||||
"Hydra::Schema::JobsetEvals",
|
"Hydra::Schema::JobsetEvals",
|
||||||
{
|
{ "foreign.jobset_id" => "self.id" },
|
||||||
"foreign.jobset" => "self.name",
|
|
||||||
"foreign.project" => "self.project",
|
|
||||||
},
|
|
||||||
undef,
|
undef,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -375,8 +372,8 @@ __PACKAGE__->has_many(
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-22 07:11:57
|
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-25 14:38:14
|
||||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6P1qlC5oVSPRSgRBp6nmrw
|
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7XtIqrrGAIvReqly1kapog
|
||||||
|
|
||||||
|
|
||||||
=head2 builds
|
=head2 builds
|
||||||
|
|
|
@ -157,21 +157,6 @@ __PACKAGE__->has_many(
|
||||||
undef,
|
undef,
|
||||||
);
|
);
|
||||||
|
|
||||||
=head2 jobsetevals
|
|
||||||
|
|
||||||
Type: has_many
|
|
||||||
|
|
||||||
Related object: L<Hydra::Schema::JobsetEvals>
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
__PACKAGE__->has_many(
|
|
||||||
"jobsetevals",
|
|
||||||
"Hydra::Schema::JobsetEvals",
|
|
||||||
{ "foreign.project" => "self.name" },
|
|
||||||
undef,
|
|
||||||
);
|
|
||||||
|
|
||||||
=head2 jobsetrenames
|
=head2 jobsetrenames
|
||||||
|
|
||||||
Type: has_many
|
Type: has_many
|
||||||
|
@ -258,8 +243,8 @@ Composing rels: L</projectmembers> -> username
|
||||||
__PACKAGE__->many_to_many("usernames", "projectmembers", "username");
|
__PACKAGE__->many_to_many("usernames", "projectmembers", "username");
|
||||||
|
|
||||||
|
|
||||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-22 07:11:57
|
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-25 14:38:14
|
||||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Ff5gJejFu+02b0lInobOoQ
|
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+4yWd9UjCyxxLZYDrVUAxA
|
||||||
|
|
||||||
my %hint = (
|
my %hint = (
|
||||||
columns => [
|
columns => [
|
||||||
|
|
|
@ -440,9 +440,7 @@ create table SystemTypes (
|
||||||
|
|
||||||
create table JobsetEvals (
|
create table JobsetEvals (
|
||||||
id serial primary key not null,
|
id serial primary key not null,
|
||||||
|
jobset_id integer not null,
|
||||||
project text not null,
|
|
||||||
jobset text not null,
|
|
||||||
|
|
||||||
errorMsg text, -- error output from the evaluator
|
errorMsg text, -- error output from the evaluator
|
||||||
errorTime integer, -- timestamp associated with errorMsg
|
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
|
nixExprInput text, -- name of the jobsetInput containing the Nix or Guix expression
|
||||||
nixExprPath text, -- relative path of 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 (jobset_id) references Jobsets(id) on delete cascade
|
||||||
foreign key (project, jobset) references Jobsets(project, name) on delete cascade on update cascade
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -629,7 +626,8 @@ create index IndexBuildOutputsPath on BuildOutputs using hash(path);
|
||||||
create index IndexBuildsOnKeep on Builds(keep) where keep = 1;
|
create index IndexBuildsOnKeep on Builds(keep) where keep = 1;
|
||||||
|
|
||||||
-- To get the most recent eval for a jobset.
|
-- 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;
|
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;
|
Loading…
Reference in a new issue