Schema/Journal/DB/AuditHistory.pm

filter: Statementstmt 25.0% 4 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 1 / 2 Podpod 0.0% 0 / 1 totaltotal 26.3% 5 / 19 CC 3 SCAR 22.2
CC
3
Cov
25%
journal_define_table
12.0
BEGIN
1.0
CRAP 9.2
« Schema/Journal/DB.pm ↑ Summary Schema/Journal/DB/AuditLog.pm »
1 package DBIx::Class::Schema::Journal::DB::AuditHistory;
2  
3 2 ▶use base 'DBIx::Class';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 sub journal_define_table {
6 0 ▶ my ( $class, $source ) = @_;
Subroutine journal_define_table: not called CC=3 SCAR=24.8
Pod undocumented
7  
8 0 $class->load_components(qw(Core));
9  
10 0 $class->table($source->name . "_audit_history");
11
12 0 $class->add_columns(
13 audit_history_id => {
14 data_type => 'integer',
15 is_nullable => 0,
16 is_primary_key => 1,
17 is_auto_increment => 1,
18 },
19 audit_change_id => {
20 data_type => 'integer',
21 is_nullable => 0,
22 is_foreign_key => 1,
23 },
24 );
25  
26 0 $class->set_primary_key("audit_history_id");
27  
28 0 foreach my $column ( $source->columns ) {
29 0 my $info = $source->column_info($column);
30  
31 0 my %hist_info = %$info;
32  
33 0 delete $hist_info{$_} for qw(
34 is_foreign_key
35 is_primary_key
36 is_auto_increment
37 default_value
38 );
39
40 0 $hist_info{is_nullable} = 1;
41  
42 0 $class->add_column($column => \%hist_info);
43 }
44
45 0 $class->belongs_to('change', 'DBIx::Class::Schema::Journal::DB::ChangeLog', 'audit_change_id');
46 }
47  
48 2 1;
« Schema/Journal/DB.pm ↑ Summary Schema/Journal/DB/AuditLog.pm »