lib/CrashTest/Storage/Sql/Schema/Result/CrashReport.pm
changeset 78 0ebef32c34af
parent 77 e408da1419cd
child 79 4ae8bb6f8a96
equal deleted inserted replaced
77:e408da1419cd 78:0ebef32c34af
     1 # This program is free software: you can redistribute it and/or modify
       
     2 # it under the terms of the GNU General Public License as published by
       
     3 # the Free Software Foundation, either version 3 of the License, or
       
     4 # (at your option) any later version.
       
     5 #
       
     6 # This program is distributed in the hope that it will be useful,
       
     7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
       
     8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
     9 # GNU General Public License for more details.
       
    10 #
       
    11 # You should have received a copy of the GNU General Public License
       
    12 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
       
    13 
       
    14 package CrashTest::Storage::Sql::Schema::Result::CrashReport;
       
    15 
       
    16 use CrashTest::Storage::Sql::Schema::Candy;
       
    17 __PACKAGE__->load_components(qw/InflateColumn::DateTime Core/);
       
    18 
       
    19 primary_column id => {
       
    20     data_type => 'int',
       
    21     is_auto_increment => 1,
       
    22 };
       
    23 
       
    24 column start_time => {
       
    25     data_type => 'timestamp',
       
    26     inflate_datetime => 1,
       
    27     is_nullable => 1,
       
    28 };
       
    29 
       
    30 column crash_time => {
       
    31     data_type => 'timestamp',
       
    32     inflate_datetime => 1,
       
    33     is_nullable => 1,
       
    34 };
       
    35 
       
    36 column uuid => {
       
    37     data_type => 'uuid',
       
    38 };
       
    39 
       
    40 column bug_reference => {
       
    41     data_type => 'varchar',
       
    42     size => 20,
       
    43     is_nullable => 1,
       
    44 };
       
    45 
       
    46 has_one crash_report_data => 'CrashTest::Storage::Sql::Schema::Result::CrashReportData', 'crash_report_id';
       
    47 
       
    48 column crash_user_id => { data_type => 'int' };
       
    49 belongs_to crash_user => 'CrashTest::Storage::Sql::Schema::Result::CrashUser', 'crash_user_id';
       
    50 
       
    51 column product_id => { data_type => 'int' };
       
    52 belongs_to product => 'CrashTest::Storage::Sql::Schema::Result::Product', 'product_id';
       
    53 
       
    54 sub sqlt_deploy_hook {
       
    55     my ($self, $sqlt_table) = @_;
       
    56     $sqlt_table->add_index(
       
    57         name => 'crash_reports_uuid_idx',
       
    58         fields => [ 'uuid' ],
       
    59         type   => 'unique',
       
    60     );
       
    61     $sqlt_table->add_index(
       
    62         name => 'crash_reports_crash_time_idx',
       
    63         fields => [ 'crash_time' ]
       
    64     );
       
    65 }
       
    66 
       
    67 1;