File Coverage

blib/lib/RapidApp/CoreSchema/Result/Request.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             package RapidApp::CoreSchema::Result::Request;
2              
3 1     1   5683 use strict;
  1         2  
  1         28  
4 1     1   4 use warnings;
  1         2  
  1         22  
5              
6 1     1   4 use Moose;
  1         2  
  1         7  
7 1     1   6176 use MooseX::NonMoose;
  1         867  
  1         4  
8 1     1   40434 use namespace::autoclean;
  1         2  
  1         11  
9             extends 'DBIx::Class::Core';
10              
11             __PACKAGE__->table('request');
12              
13             __PACKAGE__->add_columns(
14             "id",
15             {
16             data_type => "integer",
17             extra => { unsigned => 1 },
18             is_auto_increment => 1,
19             is_nullable => 0,
20             },
21             "user_id" => {
22             data_type => "integer",
23             extra => { unsigned => 1 },
24             is_nullable => 1,
25             },
26             "timestamp" => {
27             data_type => "timestamp",
28             datetime_undef_if_invalid => 1,
29             default_value => \"current_timestamp",
30             is_nullable => 0,
31             },
32             "client_ip",
33             { data_type => "varchar", is_nullable => 0, size => 16 },
34             "client_hostname",
35             { data_type => "varchar", is_nullable => 1, size => 255 },
36             "uri",
37             { data_type => "varchar", is_nullable => 0, size => 512 },
38             "method",
39             { data_type => "varchar", is_nullable => 0, size => 8 },
40             "user_agent",
41             { data_type => "varchar", is_nullable => 1, size => 1024 },
42             "referer",
43             { data_type => "varchar", is_nullable => 1, size => 512 },
44             "serialized_request",
45             { data_type => "text", is_nullable => 1 },
46            
47             );
48             __PACKAGE__->set_primary_key("id");
49              
50             __PACKAGE__->belongs_to(
51             "user",
52             "RapidApp::CoreSchema::Result::User",
53             { id => "user_id" },
54             {
55             is_deferrable => 1,
56             join_type => "LEFT",
57             on_delete => "CASCADE",
58             on_update => "CASCADE",
59             },
60             );
61              
62              
63             __PACKAGE__->load_components('+RapidApp::DBIC::Component::TableSpec');
64              
65             ## This is MySQL-specific
66             #__PACKAGE__->add_virtual_columns(
67             # display => {
68             # data_type => "varchar",
69             # is_nullable => 0,
70             # size => 255,
71             # sql => 'SELECT CONCAT(self.id,' .
72             # 'CONCAT(" - ",' .
73             # 'CONCAT(self.client_ip,' .
74             # 'CONCAT(" [",' .
75             # 'CONCAT(self.timestamp,"]")' .
76             # ')' .
77             # ')' .
78             # ')' .
79             # ')'
80             # }
81             #);
82              
83             __PACKAGE__->apply_TableSpec;
84              
85             __PACKAGE__->TableSpec_set_conf(
86             title => 'HTTP Request',
87             title_multi => 'HTTP Requests',
88             #iconCls => 'ra-icon-world-go',
89             #multiIconCls => 'ra-icon-world-gos',
90             display_column => 'timestamp',
91             priority_rel_columns => 1,
92             );
93              
94             __PACKAGE__->meta->make_immutable;
95             1;