« Tapper/Schema/TestrunDB/Result/TestrunRequestedHost.pm
↑ Summary
Tapper/Schema/TestrunDB/Result/TestrunRequestedResourceAlternative.pm »
| 1 | package Tapper::Schema::TestrunDB::Result::TestrunRequestedResource; | ||
| 2 | 10 | our $AUTHORITY = 'cpan:TAPPER'; | |
| 3 | 10 | $Tapper::Schema::TestrunDB::Result::TestrunRequestedResource::VERSION = '5.0.12'; | |
| 4 | # ABSTRACT: Tapper - Relate testruns with list of resource alternatives ( requested ) | ||
| 5 | |||
| 6 | 10 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 10 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 10 | ▶ | use parent 'DBIx::Class'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 10 | __PACKAGE__->load_components("Core"); | |
| 12 | 10 | __PACKAGE__->table("testrun_requested_resource"); | |
| 13 | 10 | __PACKAGE__->add_columns | |
| 14 | ( | ||
| 15 | "id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 11, is_auto_increment => 1, }, | ||
| 16 | "testrun_id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 11, is_foreign_key => 1, }, | ||
| 17 | "selected_resource_id", { data_type => "INT", default_value => undef, is_nullable => 1, size => 11, is_foreign_key => 1, } | ||
| 18 | ); | ||
| 19 | |||
| 20 | 10 | __PACKAGE__->set_primary_key(qw/id/); | |
| 21 | |||
| 22 | 10 | (my $basepkg = __PACKAGE__) =~ s/::\w+$//; | |
| 23 | |||
| 24 | 10 | __PACKAGE__->belongs_to( testrunscheduling => "${basepkg}::Testrun", { 'foreign.id' => 'self.testrun_id' }); | |
| 25 | |||
| 26 | 10 | __PACKAGE__->has_many( | |
| 27 | alternatives => "${basepkg}::TestrunRequestedResourceAlternative", | ||
| 28 | { 'foreign.request_id' => 'self.id' }, | ||
| 29 | ); | ||
| 30 | |||
| 31 | 10 | __PACKAGE__->belongs_to( | |
| 32 | selected_resource => "${basepkg}::Resource", | ||
| 33 | { 'foreign.id' => 'self.selected_resource_id' }, | ||
| 34 | { join_type => 'left', on_delete => 'SET NULL' }, | ||
| 35 | ); | ||
| 36 | 10 | 1; | |
| 37 | |||
| 38 | __END__ | ||