builds: drop project, jobset columns

Indexes were haphazardly dropped.
This commit is contained in:
Graham Christensen 2022-01-08 22:27:12 -05:00
parent 1caff3a250
commit f120909547
5 changed files with 18 additions and 97 deletions

View file

@ -52,18 +52,6 @@ __PACKAGE__->table("builds");
data_type: 'integer' data_type: 'integer'
is_nullable: 0 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 =head2 jobset_id
data_type: 'integer' data_type: 'integer'
@ -206,10 +194,6 @@ __PACKAGE__->add_columns(
{ data_type => "integer", is_nullable => 0 }, { data_type => "integer", is_nullable => 0 },
"timestamp", "timestamp",
{ data_type => "integer", is_nullable => 0 }, { 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", "jobset_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"job", "job",
@ -439,21 +423,6 @@ __PACKAGE__->belongs_to(
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
); );
=head2 jobset_project_jobset
Type: belongs_to
Related object: L<Hydra::Schema::Result::Jobsets>
=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 =head2 jobsetevalinputs
Type: has_many Type: has_many
@ -484,21 +453,6 @@ __PACKAGE__->has_many(
undef, undef,
); );
=head2 project
Type: belongs_to
Related object: L<Hydra::Schema::Result::Projects>
=cut
__PACKAGE__->belongs_to(
"project",
"Hydra::Schema::Result::Projects",
{ name => "project" },
{ is_deferrable => 0, on_delete => "NO ACTION", on_update => "CASCADE" },
);
=head2 runcommandlogs =head2 runcommandlogs
Type: has_many 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 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-01-10 09:43:38
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ylttv/NTMDcSZumBXRCOCw # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:DQF8KRinnf0imJOP+lvH9Q
__PACKAGE__->has_many( __PACKAGE__->has_many(
"dependents", "dependents",

View file

@ -257,7 +257,7 @@ __PACKAGE__->has_many(
undef, undef,
); );
=head2 builds_jobset_ids =head2 builds
Type: has_many Type: has_many
@ -266,30 +266,12 @@ Related object: L<Hydra::Schema::Result::Builds>
=cut =cut
__PACKAGE__->has_many( __PACKAGE__->has_many(
"builds_jobset_ids", "builds",
"Hydra::Schema::Result::Builds", "Hydra::Schema::Result::Builds",
{ "foreign.jobset_id" => "self.id" }, { "foreign.jobset_id" => "self.id" },
undef, undef,
); );
=head2 builds_project_jobsets
Type: has_many
Related object: L<Hydra::Schema::Result::Builds>
=cut
__PACKAGE__->has_many(
"builds_project_jobsets",
"Hydra::Schema::Result::Builds",
{
"foreign.jobset" => "self.name",
"foreign.project" => "self.project",
},
undef,
);
=head2 jobsetevals =head2 jobsetevals
Type: has_many Type: has_many
@ -372,8 +354,8 @@ __PACKAGE__->has_many(
); );
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-26 12:02:36 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-01-08 22:24:10
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iI44C3BFTo6IsS1tBwWYsg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cQOnMitrWGMoJX6kZGNW+w
use JSON::MaybeXS; use JSON::MaybeXS;

View file

@ -142,21 +142,6 @@ __PACKAGE__->has_many(
undef, undef,
); );
=head2 builds
Type: has_many
Related object: L<Hydra::Schema::Result::Builds>
=cut
__PACKAGE__->has_many(
"builds",
"Hydra::Schema::Result::Builds",
{ "foreign.project" => "self.name" },
undef,
);
=head2 jobsetrenames =head2 jobsetrenames
Type: has_many Type: has_many
@ -243,8 +228,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-08-26 12:02:36 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-01-08 22:24:10
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nKVZ8ZNCZQQ52zbpDAaoQQ # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:r/wbX3FAm5/OFrrwOQL5fA
use JSON::MaybeXS; use JSON::MaybeXS;

View file

@ -162,8 +162,6 @@ create table Builds (
timestamp integer not null, -- time this build was added timestamp integer not null, -- time this build was added
-- Info about the inputs. -- Info about the inputs.
project text not null,
jobset text not null,
jobset_id integer not null, jobset_id integer not null,
job text 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 (stoptime is not null and stoptime != 0)),
check (finished = 0 or (starttime is not null and starttime != 0)), check (finished = 0 or (starttime is not null and starttime != 0)),
foreign key (jobset_id) references Jobsets(id) on delete cascade, 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
); );
@ -672,16 +668,11 @@ create index IndexBuildStepsOnStopTime on BuildSteps(stopTime desc) where startT
create index IndexBuildStepOutputsOnPath on BuildStepOutputs(path); create index IndexBuildStepOutputsOnPath on BuildStepOutputs(path);
create index IndexBuildsOnFinished on Builds(finished) where finished = 0; create index IndexBuildsOnFinished on Builds(finished) where finished = 0;
create index IndexBuildsOnIsCurrent on Builds(isCurrent) where isCurrent = 1; 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 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 IndexBuildsJobsetIdCurrentFinishedStatus on Builds(jobset_id, buildstatus) where isCurrent = 1 and finished = 1;
create index IndexBuildsJobsetIdCurrent on Builds(jobset_id) where isCurrent = 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 IndexBuildsOnTimestamp on Builds(timestamp);
create index IndexBuildsOnFinishedStopTime on Builds(finished, stoptime DESC); 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 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 IndexFinishedSuccessfulBuilds on Builds(jobset_id, job, finished, buildstatus, id DESC) where buildstatus = 0 and finished = 1;
create index IndexBuildsOnDrvPath on Builds(drvPath); create index IndexBuildsOnDrvPath on Builds(drvPath);

9
src/sql/upgrade-80.sql Normal file
View file

@ -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;