generated schema with new dbix class schema loader, grrrrrr

This commit is contained in:
Rob Vermaas
2010-02-25 09:50:04 +00:00
parent 87ea0cb2b9
commit 4dccd3c620
23 changed files with 2043 additions and 301 deletions

View File

@ -6,10 +6,151 @@ package Hydra::Schema::Builds;
use strict;
use warnings;
use base 'DBIx::Class';
use base 'DBIx::Class::Core';
=head1 NAME
Hydra::Schema::Builds
=cut
__PACKAGE__->load_components("Core");
__PACKAGE__->table("Builds");
=head1 ACCESSORS
=head2 id
data_type: integer
default_value: undef
is_auto_increment: 1
is_nullable: 0
size: undef
=head2 finished
data_type: integer
default_value: undef
is_nullable: 0
size: undef
=head2 timestamp
data_type: integer
default_value: undef
is_nullable: 0
size: undef
=head2 project
data_type: text
default_value: undef
is_foreign_key: 1
is_nullable: 0
size: undef
=head2 jobset
data_type: text
default_value: undef
is_foreign_key: 1
is_nullable: 0
size: undef
=head2 job
data_type: text
default_value: undef
is_foreign_key: 1
is_nullable: 0
size: undef
=head2 nixname
data_type: text
default_value: undef
is_nullable: 1
size: undef
=head2 description
data_type: text
default_value: undef
is_nullable: 1
size: undef
=head2 drvpath
data_type: text
default_value: undef
is_nullable: 0
size: undef
=head2 outpath
data_type: text
default_value: undef
is_nullable: 0
size: undef
=head2 system
data_type: text
default_value: undef
is_nullable: 0
size: undef
=head2 longdescription
data_type: text
default_value: undef
is_nullable: 1
size: undef
=head2 license
data_type: text
default_value: undef
is_nullable: 1
size: undef
=head2 homepage
data_type: text
default_value: undef
is_nullable: 1
size: undef
=head2 maintainers
data_type: text
default_value: undef
is_nullable: 1
size: undef
=head2 iscurrent
data_type: integer
default_value: 0
is_nullable: 1
size: undef
=head2 nixexprinput
data_type: text
default_value: undef
is_nullable: 1
size: undef
=head2 nixexprpath
data_type: text
default_value: undef
is_nullable: 1
size: undef
=cut
__PACKAGE__->add_columns(
"id",
{
@ -138,47 +279,141 @@ __PACKAGE__->add_columns(
},
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->belongs_to("project", "Hydra::Schema::Projects", { name => "project" });
=head1 RELATIONS
=head2 project
Type: belongs_to
Related object: L<Hydra::Schema::Projects>
=cut
__PACKAGE__->belongs_to("project", "Hydra::Schema::Projects", { name => "project" }, {});
=head2 jobset
Type: belongs_to
Related object: L<Hydra::Schema::Jobsets>
=cut
__PACKAGE__->belongs_to(
"jobset",
"Hydra::Schema::Jobsets",
{ name => "jobset", project => "project" },
{},
);
=head2 job
Type: belongs_to
Related object: L<Hydra::Schema::Jobs>
=cut
__PACKAGE__->belongs_to(
"job",
"Hydra::Schema::Jobs",
{ jobset => "jobset", name => "job", project => "project" },
{},
);
=head2 buildschedulinginfo
Type: might_have
Related object: L<Hydra::Schema::BuildSchedulingInfo>
=cut
__PACKAGE__->might_have(
"buildschedulinginfo",
"Hydra::Schema::BuildSchedulingInfo",
{ "foreign.id" => "self.id" },
);
=head2 buildresultinfo
Type: might_have
Related object: L<Hydra::Schema::BuildResultInfo>
=cut
__PACKAGE__->might_have(
"buildresultinfo",
"Hydra::Schema::BuildResultInfo",
{ "foreign.id" => "self.id" },
);
=head2 buildsteps
Type: has_many
Related object: L<Hydra::Schema::BuildSteps>
=cut
__PACKAGE__->has_many(
"buildsteps",
"Hydra::Schema::BuildSteps",
{ "foreign.build" => "self.id" },
);
=head2 buildinputs_builds
Type: has_many
Related object: L<Hydra::Schema::BuildInputs>
=cut
__PACKAGE__->has_many(
"buildinputs_builds",
"Hydra::Schema::BuildInputs",
{ "foreign.build" => "self.id" },
);
=head2 buildinputs_dependencies
Type: has_many
Related object: L<Hydra::Schema::BuildInputs>
=cut
__PACKAGE__->has_many(
"buildinputs_dependencies",
"Hydra::Schema::BuildInputs",
{ "foreign.dependency" => "self.id" },
);
=head2 buildproducts
Type: has_many
Related object: L<Hydra::Schema::BuildProducts>
=cut
__PACKAGE__->has_many(
"buildproducts",
"Hydra::Schema::BuildProducts",
{ "foreign.build" => "self.id" },
);
=head2 releasemembers
Type: has_many
Related object: L<Hydra::Schema::ReleaseMembers>
=cut
__PACKAGE__->has_many(
"releasemembers",
"Hydra::Schema::ReleaseMembers",
@ -186,8 +421,8 @@ __PACKAGE__->has_many(
);
# Created by DBIx::Class::Schema::Loader v0.04999_09 @ 2009-11-17 16:04:13
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Un0iCqVS8PTpSdJiTjRXeA
# Created by DBIx::Class::Schema::Loader v0.05003 @ 2010-02-25 10:29:41
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dsXIx+mh+etSD7zKQJ6I3A
use Hydra::Helper::Nix;
@ -217,14 +452,6 @@ __PACKAGE__->belongs_to(
{ id => "id" },
);
__PACKAGE__->has_one(
"actualBuildStep",
"Hydra::Schema::BuildSteps",
{ 'foreign.outpath' => 'self.outpath'
, 'foreign.build' => 'self.id'
},
);
sub addSequence {
my $hydradbi = getHydraDBPath;
if ($hydradbi =~ m/^dbi:Pg/) {
@ -271,38 +498,30 @@ QUERY
x.nixExprPath,
b.id as statusChangeId, b.timestamp as statusChangeTime
from
(select
(select max(id) from builds b
where
project = activeJobs.project and jobset = activeJobs.jobset
and job = activeJobs.job and system = activeJobs.system
and finished = 1
) as id
(select project, jobset, job, system, max(id) as id
from $activeJobs as activeJobs
) as latest
join Builds x using (id)
natural join Builds
where finished = 1
group by project, jobset, job, system)
as latest
natural join Builds x
$joinWithStatusChange
QUERY
);
makeSource("ActiveJobs$name", "(select distinct project, jobset, job from Builds where isCurrent = 1 $constraint)");
makeSource(
"LatestSucceeded$name",
<<QUERY
select *
from
(select
(select max(id) from builds b
where
project = activeJobs.project and jobset = activeJobs.jobset
and job = activeJobs.job and system = activeJobs.system
and finished = 1
and exists (select 1 from buildresultinfo where id = b.id and buildstatus = 0)
) as id
(select project, jobset, job, system, max(id) as id
from $activeJobs as activeJobs
natural join Builds
natural join BuildResultInfo
where finished = 1 and buildStatus = 0
group by project, jobset, job, system
) as latest
join Builds using (id)
natural join Builds
QUERY
);
}
@ -314,5 +533,4 @@ makeQueries('ForProject', "and project = ?");
makeQueries('ForJobset', "and project = ? and jobset = ?");
makeQueries('ForJob', "and project = ? and jobset = ? and job = ?");
1;