From e457be469c8fcf914b2dc55e8898c7f14761e109 Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Mon, 11 May 2009 13:56:52 +0000 Subject: [PATCH] sequence fix for postgresql --- src/lib/Hydra/Schema/BuildInputs.pm | 11 ++++++++--- src/lib/Hydra/Schema/Builds.pm | 9 +++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/lib/Hydra/Schema/BuildInputs.pm b/src/lib/Hydra/Schema/BuildInputs.pm index 75f433b9..b77c83c8 100644 --- a/src/lib/Hydra/Schema/BuildInputs.pm +++ b/src/lib/Hydra/Schema/BuildInputs.pm @@ -37,13 +37,18 @@ __PACKAGE__->belongs_to("dependency", "Hydra::Schema::Builds", { id => "dependen use Hydra::Helper::Nix; -if (getHydraDBPath =~ m/^dbi:Pg/) { - __PACKAGE__->sequence('builds_id_seq'); -} # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-13 13:33:20 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uxfS8+GnU06sbx6nvWzTSQ +sub addSequence { + my $hydradbi = getHydraDBPath ; + if ($hydradbi =~ m/^dbi:Pg/) { + __PACKAGE__->sequence('builds_id_seq'); + } +} + +addSequence ; # You can replace this text with custom content, and it will be preserved on regeneration 1; diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index f2702bc6..68905b66 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -104,8 +104,11 @@ __PACKAGE__->belongs_to( { id => "id" }, ); -if (getHydraPath =~ m/^dbi:Pg/) { - __PACKAGE__->sequence('builds_id_seq'); +sub addSequence { + my $hydradbi = getHydraDBPath ; + if ($hydradbi =~ m/^dbi:Pg/) { + __PACKAGE__->sequence('builds_id_seq'); + } } sub makeSource { @@ -123,6 +126,8 @@ sub makeQueries { makeSource('LatestSucceeded' . $name, "select * from (select project, jobset, job, system, max(id) as id from Builds natural join BuildResultInfo where finished = 1 and buildStatus = 0 $constraint group by project, jobset, job, system) as a natural join Builds"); } +addSequence; + makeQueries('', ""); makeQueries('ForProject', "and project = ?"); makeQueries('ForJobset', "and project = ? and jobset = ?");