File Coverage

blib/lib/Tapper/Schema/TestrunDB/Result/ReportgroupArbitrary.pm
Criterion Covered Total %
statement 10 16 62.5
branch n/a
condition n/a
subroutine 4 5 80.0
pod 2 2 100.0
total 16 23 69.5


line stmt bran cond sub pod time code
1             package Tapper::Schema::TestrunDB::Result::ReportgroupArbitrary;
2             our $AUTHORITY = 'cpan:TAPPER';
3             $Tapper::Schema::TestrunDB::Result::ReportgroupArbitrary::VERSION = '5.0.11';
4             # ABSTRACT: Tapper - Containing relations between reports and arbitrary ids
5              
6 7     7   3440 use strict;
  7         17  
  7         180  
7 7     7   34 use warnings;
  7         23  
  7         161  
8              
9 7     7   86 use parent 'DBIx::Class';
  7         15  
  7         42  
10              
11             __PACKAGE__->load_components("Core");
12             __PACKAGE__->table("reportgrouparbitrary");
13             __PACKAGE__->add_columns
14             (
15             "arbitrary_id", { data_type => "VARCHAR", default_value => undef, is_nullable => 0, size => 255, },
16             "report_id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 11, is_foreign_key => 1, },
17             "primaryreport", { data_type => "INT", default_value => undef, is_nullable => 1, size => 11, },
18             "owner", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
19             );
20              
21             __PACKAGE__->set_primary_key(qw/arbitrary_id report_id/);
22              
23             __PACKAGE__->belongs_to ( report => 'Tapper::Schema::TestrunDB::Result::Report', { 'foreign.id' => 'self.report_id' });
24              
25             # -------------------- methods on results --------------------
26              
27              
28             sub groupreports {
29 0     0 1 0 my ($self) = @_;
30              
31 0         0 my @report_ids;
32 0         0 my $rg = $self->result_source->schema->resultset('ReportgroupArbitrary')->search({ arbitrary_id => $self->arbitrary_id });
33 0         0 while (my $rg_entry = $rg->next) {
34 0         0 push @report_ids, $rg_entry->report_id;
35             }
36 0         0 return $self->result_source->schema->resultset('Report')->search({ id => [ -or => [ @report_ids ] ] });
37             }
38              
39              
40             sub sqlt_deploy_hook
41             {
42 7     7 1 22140 my ($self, $sqlt_table) = @_;
43             # $sqlt_table->add_index(name => 'reportgrouparbitrary_idx_report_id', fields => ['report_id']); # implicitely done(?)
44             }
45              
46             1;
47              
48             __END__
49              
50             =pod
51              
52             =encoding UTF-8
53              
54             =head1 NAME
55              
56             Tapper::Schema::TestrunDB::Result::ReportgroupArbitrary - Tapper - Containing relations between reports and arbitrary ids
57              
58             =head2 groupreports
59              
60             Return all reports of this testrun report group.
61              
62             =head2 sqlt_deploy_hook
63              
64             Add useful indexes at deploy time.
65              
66             =head1 AUTHORS
67              
68             =over 4
69              
70             =item *
71              
72             AMD OSRC Tapper Team <tapper@amd64.org>
73              
74             =item *
75              
76             Tapper Team <tapper-ops@amazon.com>
77              
78             =back
79              
80             =head1 COPYRIGHT AND LICENSE
81              
82             This software is Copyright (c) 2019 by Advanced Micro Devices, Inc..
83              
84             This is free software, licensed under:
85              
86             The (two-clause) FreeBSD License
87              
88             =cut