From f120909547c827a02e1fabb4b210daaf3a91f4a1 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sat, 8 Jan 2022 22:27:12 -0500 Subject: [PATCH] builds: drop project, jobset columns Indexes were haphazardly dropped. --- src/lib/Hydra/Schema/Result/Builds.pm | 50 +------------------------ src/lib/Hydra/Schema/Result/Jobsets.pm | 26 ++----------- src/lib/Hydra/Schema/Result/Projects.pm | 19 +--------- src/sql/hydra.sql | 11 +----- src/sql/upgrade-80.sql | 9 +++++ 5 files changed, 18 insertions(+), 97 deletions(-) create mode 100644 src/sql/upgrade-80.sql diff --git a/src/lib/Hydra/Schema/Result/Builds.pm b/src/lib/Hydra/Schema/Result/Builds.pm index 15c199a9..34c8e6ec 100644 --- a/src/lib/Hydra/Schema/Result/Builds.pm +++ b/src/lib/Hydra/Schema/Result/Builds.pm @@ -52,18 +52,6 @@ __PACKAGE__->table("builds"); data_type: 'integer' is_nullable: 0 -=head2 project - - data_type: 'text' - is_foreign_key: 1 - is_nullable: 0 - -=head2 jobset - - data_type: 'text' - is_foreign_key: 1 - is_nullable: 0 - =head2 jobset_id data_type: 'integer' @@ -206,10 +194,6 @@ __PACKAGE__->add_columns( { data_type => "integer", is_nullable => 0 }, "timestamp", { data_type => "integer", is_nullable => 0 }, - "project", - { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, - "jobset", - { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, "jobset_id", { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, "job", @@ -439,21 +423,6 @@ __PACKAGE__->belongs_to( { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, ); -=head2 jobset_project_jobset - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "jobset_project_jobset", - "Hydra::Schema::Result::Jobsets", - { name => "jobset", project => "project" }, - { is_deferrable => 0, on_delete => "NO ACTION", on_update => "CASCADE" }, -); - =head2 jobsetevalinputs Type: has_many @@ -484,21 +453,6 @@ __PACKAGE__->has_many( undef, ); -=head2 project - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "project", - "Hydra::Schema::Result::Projects", - { name => "project" }, - { is_deferrable => 0, on_delete => "NO ACTION", on_update => "CASCADE" }, -); - =head2 runcommandlogs Type: has_many @@ -543,8 +497,8 @@ __PACKAGE__->many_to_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-11-17 12:42:34 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ylttv/NTMDcSZumBXRCOCw +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-01-10 09:43:38 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:DQF8KRinnf0imJOP+lvH9Q __PACKAGE__->has_many( "dependents", diff --git a/src/lib/Hydra/Schema/Result/Jobsets.pm b/src/lib/Hydra/Schema/Result/Jobsets.pm index 27d8a388..13ac09e4 100644 --- a/src/lib/Hydra/Schema/Result/Jobsets.pm +++ b/src/lib/Hydra/Schema/Result/Jobsets.pm @@ -257,7 +257,7 @@ __PACKAGE__->has_many( undef, ); -=head2 builds_jobset_ids +=head2 builds Type: has_many @@ -266,30 +266,12 @@ Related object: L =cut __PACKAGE__->has_many( - "builds_jobset_ids", + "builds", "Hydra::Schema::Result::Builds", { "foreign.jobset_id" => "self.id" }, undef, ); -=head2 builds_project_jobsets - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "builds_project_jobsets", - "Hydra::Schema::Result::Builds", - { - "foreign.jobset" => "self.name", - "foreign.project" => "self.project", - }, - undef, -); - =head2 jobsetevals Type: has_many @@ -372,8 +354,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-26 12:02:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iI44C3BFTo6IsS1tBwWYsg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-01-08 22:24:10 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cQOnMitrWGMoJX6kZGNW+w use JSON::MaybeXS; diff --git a/src/lib/Hydra/Schema/Result/Projects.pm b/src/lib/Hydra/Schema/Result/Projects.pm index ca446048..35c3eeab 100644 --- a/src/lib/Hydra/Schema/Result/Projects.pm +++ b/src/lib/Hydra/Schema/Result/Projects.pm @@ -142,21 +142,6 @@ __PACKAGE__->has_many( undef, ); -=head2 builds - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "builds", - "Hydra::Schema::Result::Builds", - { "foreign.project" => "self.name" }, - undef, -); - =head2 jobsetrenames Type: has_many @@ -243,8 +228,8 @@ Composing rels: L -> username __PACKAGE__->many_to_many("usernames", "projectmembers", "username"); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-26 12:02:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nKVZ8ZNCZQQ52zbpDAaoQQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-01-08 22:24:10 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:r/wbX3FAm5/OFrrwOQL5fA use JSON::MaybeXS; diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index bbb0b097..7762e133 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -162,8 +162,6 @@ create table Builds ( timestamp integer not null, -- time this build was added -- Info about the inputs. - project text not null, - jobset text not null, jobset_id integer not null, job text not null, @@ -224,9 +222,7 @@ create table Builds ( check (finished = 0 or (stoptime is not null and stoptime != 0)), check (finished = 0 or (starttime is not null and starttime != 0)), - foreign key (jobset_id) references Jobsets(id) on delete cascade, - foreign key (project) references Projects(name) on update cascade, - foreign key (project, jobset) references Jobsets(project, name) on update cascade + foreign key (jobset_id) references Jobsets(id) on delete cascade ); @@ -672,16 +668,11 @@ create index IndexBuildStepsOnStopTime on BuildSteps(stopTime desc) where startT create index IndexBuildStepOutputsOnPath on BuildStepOutputs(path); create index IndexBuildsOnFinished on Builds(finished) where finished = 0; create index IndexBuildsOnIsCurrent on Builds(isCurrent) where isCurrent = 1; -create index IndexBuildsOnJobsetIsCurrent on Builds(project, jobset, isCurrent) where isCurrent = 1; -create index IndexBuildsOnJobIsCurrent on Builds(project, jobset, job, isCurrent) where isCurrent = 1; create index IndexBuildsJobsetIdCurrentUnfinished on Builds(jobset_id) where isCurrent = 1 and finished = 0; create index IndexBuildsJobsetIdCurrentFinishedStatus on Builds(jobset_id, buildstatus) where isCurrent = 1 and finished = 1; create index IndexBuildsJobsetIdCurrent on Builds(jobset_id) where isCurrent = 1; -create index IndexBuildsOnJobset on Builds(project, jobset); -create index IndexBuildsOnProject on Builds(project); create index IndexBuildsOnTimestamp on Builds(timestamp); create index IndexBuildsOnFinishedStopTime on Builds(finished, stoptime DESC); -create index IndexBuildsOnJobFinishedId on builds(project, jobset, job, system, finished, id DESC); create index IndexBuildsOnJobsetIdFinishedId on Builds(jobset_id, job, finished, id DESC); create index IndexFinishedSuccessfulBuilds on Builds(jobset_id, job, finished, buildstatus, id DESC) where buildstatus = 0 and finished = 1; create index IndexBuildsOnDrvPath on Builds(drvPath); diff --git a/src/sql/upgrade-80.sql b/src/sql/upgrade-80.sql new file mode 100644 index 00000000..4703bd1e --- /dev/null +++ b/src/sql/upgrade-80.sql @@ -0,0 +1,9 @@ +drop index IndexBuildsOnJobsetIsCurrent; +drop index IndexBuildsOnJobIsCurrent; +drop index IndexBuildsOnJobset; +drop index IndexBuildsOnProject; +drop index IndexBuildsOnJobFinishedId; + +alter table Builds + drop column project, + drop column jobset;