« Tapper/Schema/TestrunDB/Result/Contact.pm
↑ Summary
Tapper/Schema/TestrunDB/Result/HostFeature.pm »
| 1 | package Tapper::Schema::TestrunDB::Result::DeniedHost; | ||
| 2 | 10 | our $AUTHORITY = 'cpan:TAPPER'; | |
| 3 | 10 | $Tapper::Schema::TestrunDB::Result::DeniedHost::VERSION = '5.0.12'; | |
| 4 | # ABSTRACT: Tapper - Relation for hosts that are denied for testruns of a certain queue | ||
| 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 | # Note: Technically, it would also be possible to extend QueueHost with another element that defines | ||
| 12 | # whether the QueueHost is bound or denied for the queue. Unfortunatelly, in this case all code using | ||
| 13 | # QueueHost would have to check this new flag and thus become more complicated. A new table may seem | ||
| 14 | # to introduce more complexity at first but in the end its the easier solution. | ||
| 15 | |||
| 16 | 10 | __PACKAGE__->load_components("Core"); | |
| 17 | 10 | __PACKAGE__->table("denied_host"); | |
| 18 | 10 | __PACKAGE__->add_columns | |
| 19 | ( | ||
| 20 | "id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 11, is_auto_increment => 1, }, | ||
| 21 | "queue_id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 11, is_foreign_key => 1, }, | ||
| 22 | "host_id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 11, is_foreign_key => 1, }, | ||
| 23 | ); | ||
| 24 | |||
| 25 | 10 | __PACKAGE__->set_primary_key(qw/id/); | |
| 26 | |||
| 27 | 10 | (my $basepkg = __PACKAGE__) =~ s/::\w+$//; | |
| 28 | |||
| 29 | 10 | __PACKAGE__->belongs_to( queue => "${basepkg}::Queue", { 'foreign.id' => 'self.queue_id' }); | |
| 30 | 10 | __PACKAGE__->belongs_to( host => "${basepkg}::Host", { 'foreign.id' => 'self.host_id' }); | |
| 31 | |||
| 32 | 10 | 1; | |
| 33 | |||
| 34 | __END__ | ||