Tapper/Schema/TestrunDB/Result/Resource.pm

filter: Statementstmt 100% 20 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 24 / 24 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Tapper/Schema/TestrunDB/Result/ReportTopic.pm ↑ Summary Tapper/Schema/TestrunDB/Result/Suite.pm »
1 package Tapper::Schema::TestrunDB::Result::Resource;
2 10 our $AUTHORITY = 'cpan:TAPPER';
3 10 $Tapper::Schema::TestrunDB::Result::Resource::VERSION = '5.0.12';
4 # ABSTRACT: Resource - abstract resource
5 # Multiple testruns cannot be scheduled at the same time
6 # if they require the same resource.
7  
8 10 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 10 ▶use parent 'DBIx::Class';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 10 __PACKAGE__->load_components(qw/InflateColumn::DateTime Core/);
15 10 __PACKAGE__->table("resource");
16 10 __PACKAGE__->add_columns
17 (
18 id => {
19 data_type => "INT",
20 default_value => undef,
21 is_nullable => 0,
22 size => 11,
23 is_auto_increment => 1,
24 },
25 name => {
26 data_type => "VARCHAR",
27 default_value => "",
28 is_nullable => 1,
29 size => 255,
30 },
31 comment => {
32 data_type => "VARCHAR",
33 default_value => "",
34 is_nullable => 1,
35 size => 255,
36 },
37 active => {
38 data_type => "TINYINT",
39 default_value => "0",
40 is_nullable => 0,
41 },
42 used_by_scheduling_id => {
43 data_type => "INT",
44 default_value => undef,
45 is_nullable => 1,
46 size => 11,
47 is_foreign_key => 1,
48 },
49 created_at => {
50 data_type => "TIMESTAMP",
51 default_value => \'CURRENT_TIMESTAMP',
52 is_nullable => 1,
53 },
54 updated_at => {
55 data_type => "DATETIME",
56 default_value => undef,
57 is_nullable => 1,
58 },
59 );
60  
61 10 __PACKAGE__->set_primary_key("id");
62  
63 10 (my $basepkg = __PACKAGE__) =~ s/::\w+$//;
64 10 __PACKAGE__->add_unique_constraint( constraint_name => [ qw/name/ ] );
65  
66 10 __PACKAGE__->belongs_to(
67 used_by_scheduling => "${basepkg}::TestrunScheduling",
68 { 'foreign.id' => 'self.used_by_scheduling_id' },
69 { join_type => 'left', on_delete => 'SET NULL' },
70 );
71  
72 __END__
« Tapper/Schema/TestrunDB/Result/ReportTopic.pm ↑ Summary Tapper/Schema/TestrunDB/Result/Suite.pm »