From 507e5bb1901799d81fa34f7eae3f7fc1dafd27b2 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 May 2013 16:39:17 +0200 Subject: [PATCH] Drop unused "disabled" columns --- doc/dev-notes.txt | 42 ---------------------------------- src/lib/Hydra/Schema/Builds.pm | 12 ++-------- src/lib/Hydra/Schema/Jobs.pm | 12 ++-------- src/script/hydra-queue-runner | 6 ++--- src/sql/hydra.sql | 4 ---- src/sql/upgrade-14.sql | 2 ++ 6 files changed, 9 insertions(+), 69 deletions(-) create mode 100644 src/sql/upgrade-14.sql diff --git a/doc/dev-notes.txt b/doc/dev-notes.txt index 8fa3b041..05df856a 100644 --- a/doc/dev-notes.txt +++ b/doc/dev-notes.txt @@ -70,48 +70,6 @@ - Start hydra_evaluator and hydra_queue_runner -* Upgrade notes: - - alter table builds add column longDescription text; - alter table builds add column license text; - alter table projects add column homepage text; - alter table builds add column homepage text; - alter table BuildProducts add column defaultPath text; - alter table BuildResultInfo add column failedDepBuild integer; - alter table BuildResultInfo add column failedDepStepNr integer; - alter table ReleaseSetJobs add column jobset text not null default "trunk"; - === (DB dump/load needed after Sqlite upgrade) === - insert into jobs(project, jobset, name, active) select distinct project, jobset, job, 0 from builds b where not exists (select 1 from jobs where project = b.project and jobset = b.jobset and name = b.job); - - create index IndexBuildInputsByBuild on BuildInputs(build); - create index IndexBuildInputsByDependency on BuildInputs(dependency); - - create index IndexBuildsByTimestamp on Builds(timestamp); - - alter table jobs add column disabled integer not null default 0; - alter table builds add column maintainers text; - - # Add the isCurrent column to Builds and use the obsolete Jobs.active to fill it in. - alter table builds add column isCurrent integer default 0; - update builds set isCurrent = 1 where id in (select max(id) from builds natural join (select distinct b.project, b.jobset, b.job, b.system from builds b join (select project, jobset, name from jobs where active = 1) j on b.project = j.project and b.jobset = j.jobset and b.job = j.name) b2 group by project, jobset, job, system); - - alter table Jobsets add column enabled integer not null default 1; - - # Releases -> Views. - alter table ReleaseSets rename to Views; - alter table ReleaseSetJobs rename to ViewJobs; - alter table ViewJobs rename column release_ to view_; - alter table ViewJobs drop column mayFail; - alter table ViewJobs add column autorelease integer not null default 0; - - alter table Builds add column nixExprInput text; - alter table Builds add column nixExprPath text; - - # Adding JobsetEvals. - drop table JobsetInputHashes; - (add JobsetEvals, JobsetEvalMembers) - - * Job selection: php-sat:build [system = "i686-linux"] diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index 03e928bb..db246910 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -147,12 +147,6 @@ __PACKAGE__->table("Builds"); data_type: 'text' is_nullable: 1 -=head2 disabled - - data_type: 'integer' - default_value: 0 - is_nullable: 0 - =head2 starttime data_type: 'integer' @@ -248,8 +242,6 @@ __PACKAGE__->add_columns( { data_type => "text", is_nullable => 1 }, "logfile", { data_type => "text", is_nullable => 1 }, - "disabled", - { data_type => "integer", default_value => 0, is_nullable => 0 }, "starttime", { data_type => "integer", is_nullable => 1 }, "stoptime", @@ -465,8 +457,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-01-30 16:22:11 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YBdqPWScG4dtGx+U3dJcwA +# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-05-03 14:35:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:aYVEk+AeDsgTRi5GAqOhEw __PACKAGE__->has_many( "dependents", diff --git a/src/lib/Hydra/Schema/Jobs.pm b/src/lib/Hydra/Schema/Jobs.pm index d9076075..7a86eb6c 100644 --- a/src/lib/Hydra/Schema/Jobs.pm +++ b/src/lib/Hydra/Schema/Jobs.pm @@ -61,12 +61,6 @@ __PACKAGE__->table("Jobs"); data_type: 'integer' is_nullable: 1 -=head2 disabled - - data_type: 'integer' - default_value: 0 - is_nullable: 0 - =cut __PACKAGE__->add_columns( @@ -84,8 +78,6 @@ __PACKAGE__->add_columns( { data_type => "integer", is_nullable => 1 }, "lastevaltime", { data_type => "integer", is_nullable => 1 }, - "disabled", - { data_type => "integer", default_value => 0, is_nullable => 0 }, ); =head1 PRIMARY KEY @@ -156,7 +148,7 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-01-22 13:29:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Vfl4QtuyeKeEk9+Ap7FP2A +# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-05-03 14:35:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uZ27Dcbywi99pCW7Ml4j3A 1; diff --git a/src/script/hydra-queue-runner b/src/script/hydra-queue-runner index 0c845049..cefef9c2 100755 --- a/src/script/hydra-queue-runner +++ b/src/script/hydra-queue-runner @@ -55,7 +55,7 @@ sub findBuildDependencyInQueue { my @deps = grep { /\.drv$/ && $_ ne $build->drvpath } computeFSClosure(0, 0, $build->drvpath); return unless scalar @deps > 0; return $db->resultset('Builds')->search( - { drvpath => [ @deps ], finished => 0, enabled => 1, disabled => 0 }, + { drvpath => [ @deps ], finished => 0, enabled => 1 }, { join => ['project'], rows => 1 })->single; } @@ -79,7 +79,7 @@ sub checkBuilds { # Get the system types for the runnable builds. my @systemTypes = $db->resultset('Builds')->search( - { finished => 0, busy => 0, enabled => 1, disabled => 0 }, + { finished => 0, busy => 0, enabled => 1 }, { join => ['project'], select => ['system'], as => ['system'], distinct => 1 }); # For each system type, select up to the maximum number of @@ -99,7 +99,7 @@ sub checkBuilds { # Select the highest-priority builds to start. my @builds = $extraAllowed == 0 ? () : $db->resultset('Builds')->search( - { finished => 0, busy => 0, system => $system->system, enabled => 1, disabled => 0 }, + { finished => 0, busy => 0, system => $system->system, enabled => 1 }, { join => ['project'], order_by => ["priority DESC", "timestamp"], rows => $extraAllowed }); diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index 9e543edf..097a421c 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -107,8 +107,6 @@ create table Jobs ( firstEvalTime integer, -- first time the evaluator saw this job lastEvalTime integer, -- last time the evaluator saw this job - disabled integer not null default 0, -- !!! not currently used - primary key (project, jobset, name), 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 @@ -160,8 +158,6 @@ create table Builds ( logfile text, -- if busy, the path of the logfile - disabled integer not null default 0, -- !!! boolean - startTime integer, -- if busy, time we started stopTime integer, diff --git a/src/sql/upgrade-14.sql b/src/sql/upgrade-14.sql new file mode 100644 index 00000000..b02100be --- /dev/null +++ b/src/sql/upgrade-14.sql @@ -0,0 +1,2 @@ +alter table Jobs drop column disabled; +alter table Builds drop column disabled;