line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Class::Schema::Diff::InfoPacket; |
2
|
5
|
|
|
5
|
|
36
|
use strict; |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
166
|
|
3
|
5
|
|
|
5
|
|
30
|
use warnings; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
128
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
28
|
use Moo; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
44
|
|
6
|
|
|
|
|
|
|
with 'DBIx::Class::Schema::Diff::Role::Common'; |
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
2168
|
use Types::Standard qw(:all); |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
50
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'name', required => 1, is => 'ro', isa => Str; |
11
|
|
|
|
|
|
|
has 'old_info', is => 'ro', isa => Maybe[HashRef], default => sub { undef }; |
12
|
|
|
|
|
|
|
has 'new_info', required => 1, is => 'ro', isa => Maybe[HashRef]; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has 'diff_added', is => 'ro', isa => Bool, default => sub { 0 }; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has '_source_diff', required => 1, is => 'ro', isa => InstanceOf[ |
17
|
|
|
|
|
|
|
'DBIx::Class::Schema::Diff::Source' |
18
|
|
|
|
|
|
|
]; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has 'added', is => 'ro', lazy => 1, default => sub { |
21
|
|
|
|
|
|
|
my $self = shift; |
22
|
|
|
|
|
|
|
defined $self->new_info && ! defined $self->old_info |
23
|
|
|
|
|
|
|
}, init_arg => undef, isa => Bool; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has 'deleted', is => 'ro', lazy => 1, default => sub { |
26
|
|
|
|
|
|
|
my $self = shift; |
27
|
|
|
|
|
|
|
defined $self->old_info && ! defined $self->new_info |
28
|
|
|
|
|
|
|
}, init_arg => undef, isa => Bool; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has 'diff', is => 'ro', lazy => 1, default => sub { |
32
|
|
|
|
|
|
|
my $self = shift; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# There is no reason to diff in the case of added/deleted: |
35
|
|
|
|
|
|
|
return { _event => 'deleted' } if ($self->deleted); |
36
|
|
|
|
|
|
|
return { _event => 'added' } if ($self->added && ! $self->diff_added); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my ($o,$n) = ($self->old_info,$self->new_info); |
39
|
|
|
|
|
|
|
my $diff = $self->_info_diff($o,$n) or return undef; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return { _event => 'changed', diff => $diff }; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
}, init_arg => undef, isa => Maybe[HashRef]; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
0
|
|
|
sub _schema_diff { (shift)->_source_diff->_schema_diff } |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |