« Tapper/Schema/TestrunDB/Result/ChartMarkings.pm
↑ Summary
Tapper/Schema/TestrunDB/Result/ChartTags.pm »
| 1 | package Tapper::Schema::TestrunDB::Result::ChartTagRelations; | ||
| 2 | 10 | our $AUTHORITY = 'cpan:TAPPER'; | |
| 3 | 10 | $Tapper::Schema::TestrunDB::Result::ChartTagRelations::VERSION = '5.0.12'; | |
| 4 | # ABSTRACT: Tapper - Keep relations between charts and chart tags | ||
| 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(qw/FilterColumn InflateColumn::DateTime Core/); | |
| 12 | 10 | __PACKAGE__->table('chart_tag_relations'); | |
| 13 | 10 | __PACKAGE__->add_columns( | |
| 14 | 'chart_id', { | ||
| 15 | data_type => 'INT', | ||
| 16 | default_value => undef, | ||
| 17 | is_nullable => 0, | ||
| 18 | size => 11, | ||
| 19 | is_foreign_key => 1, | ||
| 20 | extra => { | ||
| 21 | unsigned => 1, | ||
| 22 | }, | ||
| 23 | }, | ||
| 24 | 'chart_tag_id', { | ||
| 25 | data_type => 'SMALLINT', | ||
| 26 | default_value => undef, | ||
| 27 | is_nullable => 0, | ||
| 28 | size => 6, | ||
| 29 | is_foreign_key => 1, | ||
| 30 | extra => { | ||
| 31 | unsigned => 1, | ||
| 32 | }, | ||
| 33 | }, | ||
| 34 | 'created_at', { | ||
| 35 | data_type => 'TIMESTAMP', | ||
| 36 | default_value => undef, | ||
| 37 | is_nullable => 0, | ||
| 38 | set_on_create => 1, | ||
| 39 | }, | ||
| 40 | ); | ||
| 41 | |||
| 42 | |||
| 43 | 10 | (my $basepkg = __PACKAGE__) =~ s/::\w+$//; | |
| 44 | |||
| 45 | 10 | __PACKAGE__->set_primary_key('chart_id','chart_tag_id'); | |
| 46 | |||
| 47 | 10 | __PACKAGE__->belongs_to( | |
| 48 | chart => "${basepkg}::Charts", | ||
| 49 | { 'foreign.chart_id' => 'self.chart_id' }, | ||
| 50 | ); | ||
| 51 | 10 | __PACKAGE__->belongs_to( | |
| 52 | chart_tag => "${basepkg}::ChartTags", | ||
| 53 | { 'foreign.chart_tag_id' => 'self.chart_tag_id' }, | ||
| 54 | ); | ||
| 55 | |||
| 56 | 10 | 1; | |
| 57 | |||
| 58 | __END__ | ||