| 1 | package Tapper::Schema::TestrunDB::Result::ChartVersions; | ||
| 2 | 10 | our $AUTHORITY = 'cpan:TAPPER'; | |
| 3 | 10 | $Tapper::Schema::TestrunDB::Result::ChartVersions::VERSION = '5.0.12'; | |
| 4 | # ABSTRACT: Tapper - Keep Charts for Tapper-Reports-Web-GUI | ||
| 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/InflateColumn::DateTime Core/); | |
| 12 | 10 | __PACKAGE__->table('chart_versions'); | |
| 13 | 10 | __PACKAGE__->add_columns( | |
| 14 | 'chart_version_id', { | ||
| 15 | data_type => 'INT', | ||
| 16 | default_value => undef, | ||
| 17 | is_nullable => 0, | ||
| 18 | size => 11, | ||
| 19 | is_auto_increment => 1, | ||
| 20 | extra => { | ||
| 21 | unsigned => 1, | ||
| 22 | }, | ||
| 23 | }, | ||
| 24 | 'chart_id', { | ||
| 25 | data_type => 'INT', | ||
| 26 | default_value => undef, | ||
| 27 | is_nullable => 0, | ||
| 28 | size => 11, | ||
| 29 | is_foreign_key => 1, | ||
| 30 | extra => { | ||
| 31 | unsigned => 1, | ||
| 32 | }, | ||
| 33 | }, | ||
| 34 | 'chart_type_id', { | ||
| 35 | data_type => 'TINYINT', | ||
| 36 | default_value => undef, | ||
| 37 | is_nullable => 0, | ||
| 38 | size => 4, | ||
| 39 | is_foreign_key => 1, | ||
| 40 | extra => { | ||
| 41 | unsigned => 1, | ||
| 42 | }, | ||
| 43 | }, | ||
| 44 | 'chart_axis_type_x_id', { | ||
| 45 | data_type => 'TINYINT', | ||
| 46 | default_value => undef, | ||
| 47 | is_nullable => 0, | ||
| 48 | size => 4, | ||
| 49 | is_foreign_key => 1, | ||
| 50 | extra => { | ||
| 51 | unsigned => 1, | ||
| 52 | }, | ||
| 53 | }, | ||
| 54 | 'chart_axis_type_y_id', { | ||
| 55 | data_type => 'TINYINT', | ||
| 56 | default_value => undef, | ||
| 57 | is_nullable => 0, | ||
| 58 | size => 4, | ||
| 59 | is_foreign_key => 1, | ||
| 60 | extra => { | ||
| 61 | unsigned => 1, | ||
| 62 | }, | ||
| 63 | }, | ||
| 64 | 'chart_version', { | ||
| 65 | data_type => 'TINYINT', | ||
| 66 | default_value => undef, | ||
| 67 | is_nullable => 0, | ||
| 68 | size => 4, | ||
| 69 | extra => { | ||
| 70 | unsigned => 1, | ||
| 71 | }, | ||
| 72 | }, | ||
| 73 | 'chart_name', { | ||
| 74 | data_type => 'VARCHAR', | ||
| 75 | default_value => undef, | ||
| 76 | is_nullable => 0, | ||
| 77 | size => 64, | ||
| 78 | }, | ||
| 79 | 'order_by_x_axis', { | ||
| 80 | data_type => 'TINYINT', | ||
| 81 | default_value => undef, | ||
| 82 | is_nullable => 0, | ||
| 83 | size => 4, | ||
| 84 | extra => { | ||
| 85 | unsigned => 1, | ||
| 86 | }, | ||
| 87 | }, | ||
| 88 | 'order_by_y_axis', { | ||
| 89 | data_type => 'TINYINT', | ||
| 90 | default_value => undef, | ||
| 91 | is_nullable => 0, | ||
| 92 | size => 4, | ||
| 93 | extra => { | ||
| 94 | unsigned => 1, | ||
| 95 | }, | ||
| 96 | }, | ||
| 97 | 'created_at', { | ||
| 98 | data_type => 'TIMESTAMP', | ||
| 99 | default_value => undef, | ||
| 100 | is_nullable => 0, | ||
| 101 | set_on_create => 1, | ||
| 102 | }, | ||
| 103 | 'updated_at', { | ||
| 104 | data_type => 'TIMESTAMP', | ||
| 105 | default_value => undef, | ||
| 106 | is_nullable => 1, | ||
| 107 | }, | ||
| 108 | ); | ||
| 109 | |||
| 110 | 10 | (my $basepkg = __PACKAGE__) =~ s/::\w+$//; | |
| 111 | |||
| 112 | 10 | __PACKAGE__->set_primary_key('chart_version_id'); | |
| 113 | 10 | __PACKAGE__->add_unique_constraint( | |
| 114 | ux_chart_versions_01 => [ 'chart_id', 'chart_version' ], | ||
| 115 | ); | ||
| 116 | |||
| 117 | 10 | __PACKAGE__->belongs_to( | |
| 118 | chart => "${basepkg}::Charts", | ||
| 119 | { 'foreign.chart_id' => 'self.chart_id' }, | ||
| 120 | ); | ||
| 121 | 10 | __PACKAGE__->belongs_to( | |
| 122 | chart_type => "${basepkg}::ChartTypes", | ||
| 123 | { 'foreign.chart_type_id' => 'self.chart_type_id' }, | ||
| 124 | ); | ||
| 125 | 10 | __PACKAGE__->belongs_to( | |
| 126 | chart_axis_type_x => "${basepkg}::ChartAxisTypes", | ||
| 127 | { 'foreign.chart_axis_type_id' => 'self.chart_axis_type_x_id' }, | ||
| 128 | ); | ||
| 129 | 10 | __PACKAGE__->belongs_to( | |
| 130 | chart_axis_type_y => "${basepkg}::ChartAxisTypes", | ||
| 131 | { 'foreign.chart_axis_type_id' => 'self.chart_axis_type_y_id' }, | ||
| 132 | ); | ||
| 133 | 10 | __PACKAGE__->has_many( | |
| 134 | chart_lines => 'Tapper::Schema::TestrunDB::Result::ChartLines', | ||
| 135 | { 'foreign.chart_version_id' => 'self.chart_version_id' }, | ||
| 136 | ); | ||
| 137 | 10 | __PACKAGE__->has_many( | |
| 138 | chart_markings => 'Tapper::Schema::TestrunDB::Result::ChartMarkings', | ||
| 139 | { 'foreign.chart_version_id' => 'self.chart_version_id' }, | ||
| 140 | ); | ||
| 141 | |||
| 142 | 10 | 1; | |
| 143 | |||
| 144 | __END__ | ||