line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
115272
|
use 5.14.2; |
|
2
|
|
|
|
|
293
|
|
2
|
2
|
|
|
1
|
|
1450
|
use Modern::Perl; |
|
2
|
|
|
|
|
573
|
|
|
2
|
|
|
|
|
146
|
|
3
|
2
|
|
|
1
|
|
925
|
use Moops; |
|
2
|
|
|
|
|
37802
|
|
|
2
|
|
|
|
|
144
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
1
|
|
165390
|
class DBIx::Deployer::Patch 1.2.3 { |
|
2
|
|
|
1
|
|
217
|
|
|
2
|
|
|
|
|
166
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
57
|
|
|
1
|
|
|
|
|
303
|
|
|
1
|
|
|
|
|
1676
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
1363
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
59
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
45
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
92
|
|
|
1
|
|
|
|
|
28
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
4282
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
709
|
|
|
1
|
|
|
|
|
3837
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
154
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
461
|
|
|
1
|
|
|
|
|
6907
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
640
|
|
|
1
|
|
|
|
|
2489
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
1225
|
|
|
1
|
|
|
|
|
2374
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
123603
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
106
|
|
|
1
|
|
|
|
|
4491
|
|
|
1
|
|
|
|
|
12
|
|
7
|
1
|
|
|
1
|
|
5
|
use Digest::MD5; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
8
|
1
|
|
|
1
|
|
462
|
use Term::ANSIColor qw(colored); |
|
1
|
|
|
|
|
7251
|
|
|
1
|
|
|
|
|
695
|
|
9
|
1
|
|
|
1
|
|
523
|
use Data::Printer colored => 1; |
|
1
|
|
|
|
|
21262
|
|
|
1
|
|
|
|
|
8
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
|
|
14
|
has deployed => ( is => 'rw', isa => Bool, default => 0 ); |
12
|
1
|
|
|
|
|
3716
|
has verified => ( is => 'rw', isa => Bool, default => 0 ); |
13
|
1
|
|
|
|
|
1520
|
has name => ( is => 'ro', isa => Str, required => true ); |
14
|
1
|
|
|
|
|
685
|
has supports_transactions => ( is => 'ro', isa => Bool, default => true ); |
15
|
1
|
|
|
|
|
487
|
has dependencies => ( is => 'ro', isa => Maybe[ArrayRef] ); |
16
|
1
|
|
|
|
|
1312
|
has deploy_sql => ( is => 'ro', isa => Maybe[Str] ); |
17
|
1
|
|
|
|
|
1423
|
has deploy_sql_args => ( is => 'rw', isa => Maybe[ArrayRef] ); |
18
|
1
|
|
|
|
|
1668
|
has deploy_script => ( is => 'ro', isa => Maybe[Str] ); |
19
|
1
|
|
|
|
|
751
|
has deploy_script_args => ( is => 'rw', isa => Maybe[ArrayRef] ); |
20
|
1
|
|
|
|
|
1582
|
has no_verify => ( is => 'ro', isa => Bool, default => false ); |
21
|
1
|
|
|
|
|
446
|
has verify_sql => ( is => 'ro', isa => Str ); |
22
|
1
|
|
|
|
|
398
|
has verify_sql_args => ( is => 'rw', isa => ArrayRef ); |
23
|
1
|
|
|
|
|
1444
|
has verify_expects => ( is => 'ro', isa => ArrayRef ); |
24
|
1
|
|
|
|
|
450
|
has db => ( is => 'ro', isa => InstanceOf['DBI::db'], required => true ); |
25
|
|
|
|
|
|
|
|
26
|
1
|
50
|
|
1
|
|
2959
|
method deploy { |
|
1
|
|
|
13
|
|
2
|
|
|
1
|
|
|
|
|
323
|
|
|
1
|
|
|
|
|
4121
|
|
|
0
|
|
|
|
|
0
|
|
|
13
|
|
|
|
|
1902
|
|
27
|
13
|
50
|
33
|
|
|
34
|
if($self->deploy_sql && $self->deploy_script) { |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
28
|
13
|
|
|
|
|
339
|
$self->handle_error('Patch cannot have both deploy_sql and deploy_script.'); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
elsif($self->deploy_sql) { |
31
|
13
|
100
|
|
|
|
289
|
if($self->deploy_sql_args){ |
32
|
13
|
50
|
|
|
|
173
|
$self->db->do($self->deploy_sql, {}, @{ $self->deploy_sql_args }) |
|
12
|
|
|
|
|
5398
|
|
33
|
|
|
|
|
|
|
or $self->handle_error($self->db->errstr); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
else{ |
36
|
12
|
100
|
|
|
|
39
|
$self->db->do($self->deploy_sql) or $self->handle_error($self->db->errstr); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
elsif($self->deploy_script) { |
40
|
12
|
0
|
|
|
|
331
|
if( my $status = system $self->deploy_script, @{ $self->deploy_script_args || [] } ) { |
|
12
|
0
|
|
|
|
716
|
|
41
|
12
|
|
|
|
|
187
|
$self->handle_error("Exited with status $status."); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
else { |
45
|
12
|
|
|
|
|
25
|
$self->handle_error('Patch has neither deploy_sql nor deploy_script.'); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
1
|
50
|
|
1
|
|
1073
|
before deploy { |
|
1
|
|
|
13
|
|
2
|
|
|
1
|
|
|
|
|
137
|
|
|
1
|
|
|
|
|
2349
|
|
|
12
|
|
|
|
|
84
|
|
|
1
|
|
|
|
|
38
|
|
50
|
1
|
50
|
|
|
|
81
|
die colored(['red'], 'Patch "' . $self->name . '" is already deployed') if $self->deployed; |
51
|
11
|
50
|
33
|
|
|
72
|
if($self->supports_transactions && !$self->deploy_script){ $self->db->begin_work; } |
|
11
|
|
|
|
|
99
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
1
|
50
|
|
1
|
|
1126
|
after deploy { |
|
1
|
|
|
12
|
|
2
|
|
|
1
|
|
|
|
|
74
|
|
|
1
|
|
|
|
|
50
|
|
|
1
|
|
|
|
|
5
|
|
|
10
|
|
|
|
|
26
|
|
55
|
10
|
|
|
|
|
228
|
$self->deployed(1); |
56
|
1
|
|
|
|
|
17
|
$self->verify; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
1
|
50
|
|
1
|
|
939
|
method verify { |
|
1
|
|
|
12
|
|
2
|
|
|
1
|
|
|
|
|
259
|
|
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
212
|
|
60
|
10
|
100
|
|
|
|
1335
|
if($self->no_verify){ |
61
|
11
|
|
|
|
|
968
|
$self->verified(1); |
62
|
11
|
|
|
|
|
26
|
return; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
11
|
100
|
66
|
|
|
337
|
unless($self->verify_sql && @{ $self->verify_expects || [] }){ |
|
10
|
100
|
|
|
|
179
|
|
66
|
10
|
|
|
|
|
90719
|
$self->handle_error('Patch is missing verification attributes'); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
10
|
|
|
|
|
380
|
my $result; |
70
|
|
|
|
|
|
|
|
71
|
1
|
100
|
|
|
|
15
|
if($self->verify_sql_args){ |
72
|
3
|
50
|
|
|
|
553
|
$result = $self->db->selectall_arrayref($self->verify_sql, {}, @{ $self->verify_sql_args }) |
|
3
|
|
|
|
|
17
|
|
73
|
|
|
|
|
|
|
or $self->handle_error($self->db->errstr); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
else{ |
76
|
3
|
50
|
|
|
|
15
|
$result = $self->db->selectall_arrayref($self->verify_sql) |
77
|
|
|
|
|
|
|
or $self->handle_error($self->db->errstr); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
3
|
|
|
|
|
14
|
$self->verified($self->_check_signature($result)); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
1
|
50
|
|
1
|
|
935
|
after verify { |
|
1
|
|
|
11
|
|
2
|
|
|
1
|
|
|
|
|
163
|
|
|
1
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
15
|
|
84
|
3
|
100
|
|
|
|
6
|
if($self->verified){ |
85
|
3
|
50
|
33
|
|
|
37
|
if($self->supports_transactions && !$self->deploy_script){ |
86
|
3
|
|
|
|
|
96
|
$self->db->commit; |
87
|
|
|
|
|
|
|
} |
88
|
3
|
|
|
|
|
515
|
say colored(['green'], 'Patch "' . $self->name . '" completed successfully'); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
else{ |
91
|
3
|
|
|
|
|
57
|
$self->handle_error('Failed verification'); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
1
|
50
|
|
1
|
|
15342
|
method handle_error ( Str $error ){ |
|
1
|
50
|
|
3
|
|
3
|
|
|
1
|
50
|
|
|
|
132
|
|
|
1
|
50
|
|
|
|
6
|
|
|
1
|
50
|
|
|
|
2
|
|
|
1
|
|
|
|
|
165
|
|
|
1
|
|
|
|
|
89
|
|
|
10
|
|
|
|
|
56
|
|
|
10
|
|
|
|
|
44
|
|
|
10
|
|
|
|
|
56
|
|
|
10
|
|
|
|
|
77
|
|
|
10
|
|
|
|
|
28
|
|
|
10
|
|
|
|
|
37
|
|
|
10
|
|
|
|
|
22
|
|
96
|
10
|
50
|
33
|
|
|
265
|
if($self->supports_transactions && !$self->deploy_script){ |
97
|
10
|
|
|
|
|
53
|
$self->deployed(0); |
98
|
1
|
50
|
|
|
|
110
|
$self->db->rollback or die $self->name . ': ' . $self->db->errstr; |
99
|
|
|
|
|
|
|
} |
100
|
1
|
|
|
|
|
15
|
die colored(['red'], 'Patch "' . $self->name . '" failed: ' . $error); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
1
|
50
|
|
1
|
|
1931
|
method _check_signature ( ArrayRef $result ){ |
|
1
|
50
|
|
10
|
|
9
|
|
|
1
|
50
|
|
|
|
134
|
|
|
1
|
50
|
|
|
|
6
|
|
|
1
|
50
|
|
|
|
2
|
|
|
1
|
|
|
|
|
170
|
|
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
2793
|
|
|
1
|
|
|
|
|
60
|
|
|
10
|
|
|
|
|
3187
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
104
|
0
|
|
|
|
|
0
|
my $is_equal = $self->_signature($result) eq $self->_signature($self->verify_expects); |
105
|
0
|
100
|
|
|
|
0
|
unless ( $is_equal ) { |
106
|
0
|
|
|
|
|
0
|
say 'Expected:'; |
107
|
0
|
|
|
|
|
0
|
say p( $self->verify_expects ); |
108
|
0
|
|
|
|
|
0
|
say "\nReceived:"; |
109
|
0
|
|
|
|
|
0
|
say p( $result ); |
110
|
|
|
|
|
|
|
} |
111
|
0
|
|
|
|
|
0
|
return $is_equal; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
1
|
0
|
|
1
|
|
2111
|
multi method _signature( HashRef $params ) { |
|
1
|
0
|
|
0
|
|
2
|
|
|
1
|
0
|
|
|
|
188
|
|
|
1
|
0
|
|
|
|
6
|
|
|
1
|
0
|
|
|
|
2
|
|
|
1
|
0
|
|
|
|
182
|
|
|
1
|
0
|
|
|
|
4
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
53
|
|
|
|
|
27005
|
|
|
53
|
|
|
|
|
305
|
|
|
53
|
|
|
|
|
170
|
|
|
53
|
|
|
|
|
142
|
|
|
53
|
|
|
|
|
134
|
|
|
53
|
|
|
|
|
128
|
|
|
53
|
|
|
|
|
123
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
115
|
|
|
|
|
|
|
return Digest::MD5::md5_base64( |
116
|
|
|
|
|
|
|
join( |
117
|
|
|
|
|
|
|
'', |
118
|
|
|
|
|
|
|
map { |
119
|
0
|
|
|
|
|
0
|
$self->_signature($_) |
120
|
53
|
|
|
|
|
77
|
. $self->_signature( $params->{$_} ) |
121
|
|
|
|
|
|
|
} sort keys %$params |
122
|
|
|
|
|
|
|
) |
123
|
|
|
|
|
|
|
); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
1
|
50
|
|
1
|
|
2427
|
multi method _signature( ArrayRef $params ) { |
|
1
|
50
|
|
53
|
|
6
|
|
|
1
|
50
|
|
|
|
197
|
|
|
1
|
50
|
|
|
|
7
|
|
|
1
|
50
|
|
|
|
3
|
|
|
1
|
0
|
|
|
|
118
|
|
|
1
|
0
|
|
|
|
14
|
|
|
53
|
50
|
|
|
|
127
|
|
|
208
|
|
|
|
|
4563
|
|
|
147
|
|
|
|
|
64224
|
|
|
147
|
|
|
|
|
306
|
|
|
147
|
|
|
|
|
322
|
|
|
147
|
|
|
|
|
318
|
|
|
147
|
|
|
|
|
292
|
|
|
147
|
|
|
|
|
290
|
|
|
147
|
|
|
|
|
273
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
127
|
|
|
|
|
|
|
return Digest::MD5::md5_base64( |
128
|
0
|
|
|
|
|
0
|
join( '', map { $self->_signature($_) } @$params ) |
|
147
|
|
|
|
|
190
|
|
129
|
|
|
|
|
|
|
); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
1
|
50
|
|
1
|
|
2147
|
multi method _signature( Str $params ) { |
|
1
|
50
|
|
147
|
|
2
|
|
|
1
|
50
|
|
|
|
202
|
|
|
1
|
50
|
|
|
|
6
|
|
|
1
|
50
|
|
|
|
3
|
|
|
1
|
0
|
|
|
|
90
|
|
|
1
|
0
|
|
|
|
546
|
|
|
147
|
50
|
|
|
|
1264
|
|
|
28
|
|
|
|
|
16409
|
|
|
28
|
|
|
|
|
72
|
|
|
28
|
|
|
|
|
72
|
|
|
28
|
|
|
|
|
74
|
|
|
28
|
|
|
|
|
66
|
|
|
28
|
|
|
|
|
69
|
|
|
28
|
|
|
|
|
72
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
133
|
28
|
|
|
|
|
45
|
return Digest::MD5::md5_base64($params); |
134
|
|
|
|
|
|
|
}; |
135
|
|
|
|
|
|
|
|
136
|
1
|
50
|
|
1
|
|
2049
|
multi method _signature ( Undef $params ) { |
|
1
|
50
|
|
28
|
|
2
|
|
|
1
|
50
|
|
|
|
202
|
|
|
1
|
50
|
|
|
|
6
|
|
|
1
|
50
|
|
|
|
2
|
|
|
1
|
0
|
|
|
|
95
|
|
|
1
|
0
|
|
|
|
5
|
|
|
28
|
50
|
|
|
|
59
|
|
|
18
|
|
|
|
|
1765
|
|
|
18
|
|
|
|
|
43
|
|
|
18
|
|
|
|
|
38
|
|
|
18
|
|
|
|
|
469
|
|
|
10
|
|
|
|
|
456
|
|
|
10
|
|
|
|
|
158
|
|
|
10
|
|
|
|
|
2866
|
|
|
10
|
|
|
|
|
71
|
|
|
10
|
|
|
|
|
1759
|
|
|
10
|
|
|
|
|
40
|
|
137
|
12
|
|
|
|
|
609
|
return; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
1
|
|
|
1
|
|
100
|
class DBIx::Deployer 1.2.3 { |
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
|
|
69
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
125
|
|
|
1
|
|
|
|
|
54
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
8753
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
820
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
255
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
181
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
334
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
985
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
2013
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
105
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
46
|
|
|
1
|
|
|
|
|
825
|
|
|
1
|
|
|
|
|
8777
|
|
|
1
|
|
|
|
|
44
|
|
|
1
|
|
|
|
|
496
|
|
|
1
|
|
|
|
|
4376
|
|
|
1
|
|
|
|
|
81
|
|
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1572
|
|
|
0
|
|
|
|
|
0
|
|
142
|
1
|
|
|
1
|
|
60
|
use DBI; |
|
1
|
|
|
|
|
337
|
|
|
1
|
|
|
|
|
15619
|
|
143
|
1
|
|
|
1
|
|
4
|
use DBD::SQLite; |
|
1
|
|
|
|
|
10635
|
|
|
1
|
|
|
|
|
5
|
|
144
|
1
|
|
|
1
|
|
599
|
use JSON::XS; |
|
1
|
|
|
|
|
2567
|
|
|
1
|
|
|
|
|
3
|
|
145
|
1
|
|
|
1
|
|
217
|
use Term::ANSIColor; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
18
|
|
146
|
1
|
|
|
1
|
|
120
|
use autodie; |
|
1
|
|
|
|
|
4098
|
|
|
1
|
|
|
|
|
4
|
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
has target_db => ( is => 'lazy', isa => InstanceOf['DBI::db'], |
149
|
|
|
|
|
|
|
builder => method { |
150
|
|
|
|
|
|
|
die 'Missing attribute target_dsn. Optionally, you may pass a DBI::db as target_db' unless $self->target_dsn; |
151
|
|
|
|
|
|
|
DBI->connect( |
152
|
|
|
|
|
|
|
$self->target_dsn, |
153
|
|
|
|
|
|
|
$self->target_username, |
154
|
|
|
|
|
|
|
$self->target_password |
155
|
|
|
|
|
|
|
) or die $@; |
156
|
1
|
|
|
|
|
567
|
} |
157
|
|
|
|
|
|
|
); |
158
|
|
|
|
|
|
|
|
159
|
1
|
|
|
|
|
517
|
has target_dsn => ( is => 'ro', isa => Str ); |
160
|
1
|
|
|
|
|
200
|
has target_username => ( is => 'ro', isa => Str ); |
161
|
1
|
|
|
|
|
175
|
has target_password => ( is => 'ro', isa => Str ); |
162
|
|
|
|
|
|
|
|
163
|
1
|
|
|
|
|
134
|
has patch_path => ( is => 'ro', isa => Str, required => true ); |
164
|
1
|
|
|
|
|
126
|
has deployer_db_file => ( is => 'ro', isa => Str ); |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
has deployer_db => ( is => 'lazy', isa => InstanceOf['DBI::db'], |
167
|
|
|
|
|
|
|
builder => method { |
168
|
|
|
|
|
|
|
die 'Missing attribute deployer_db_file if using SQLite for patch management' unless $self->deployer_db_file; |
169
|
|
|
|
|
|
|
my $db = DBI->connect('dbi:SQLite:dbname=' . $self->deployer_db_file) or die $@; |
170
|
|
|
|
|
|
|
my $tables = $db->selectall_arrayref('SELECT name FROM sqlite_master WHERE type = "table"') || []; |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
unless(@$tables){ |
173
|
|
|
|
|
|
|
$self->_init($db); |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
return $db; |
176
|
1
|
|
|
|
|
129
|
} |
177
|
|
|
|
|
|
|
); |
178
|
|
|
|
|
|
|
|
179
|
0
|
|
|
|
|
0
|
has deployer_patch_table => ( is => 'ro', isa => Str, default => 'patches' ); |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
has _patches_hashref => ( |
182
|
|
|
|
|
|
|
is => 'rw', |
183
|
|
|
|
|
|
|
isa => HashRef, |
184
|
13
|
|
|
|
|
32
|
default => sub{ {} } |
185
|
13
|
|
|
|
|
826
|
); |
186
|
|
|
|
|
|
|
|
187
|
13
|
|
|
|
|
139
|
has supports_transactions => ( is => 'ro', isa => Bool, default => true ); |
188
|
0
|
|
|
|
|
0
|
has keep_newlines => ( is => 'ro', isa => Bool, default => false ); |
189
|
|
|
|
|
|
|
|
190
|
1
|
50
|
|
1
|
|
242
|
method patches { |
|
1
|
|
|
18
|
|
11
|
|
|
1
|
|
|
|
|
3
|
|
|
13
|
|
|
|
|
282
|
|
|
12
|
|
|
|
|
26
|
|
|
12
|
|
|
|
|
69
|
|
191
|
12
|
100
|
|
|
|
254
|
return $self->_patches_hashref if %{ $self->_patches_hashref }; |
|
12
|
|
|
|
|
4260
|
|
192
|
|
|
|
|
|
|
|
193
|
12
|
|
|
|
|
81
|
my $patches = $self->_patches_hashref; |
194
|
|
|
|
|
|
|
|
195
|
12
|
|
|
|
|
2217
|
opendir(my $dh, $self->patch_path); |
196
|
12
|
|
|
|
|
258
|
my @patch_files = sort readdir($dh); |
197
|
12
|
|
|
|
|
50
|
closedir($dh); |
198
|
|
|
|
|
|
|
|
199
|
13
|
|
|
|
|
982
|
shift @patch_files for 1..2; # Throw away "." and ".." |
200
|
|
|
|
|
|
|
|
201
|
13
|
|
|
|
|
5767
|
foreach my $file (@patch_files){ |
202
|
13
|
|
|
|
|
122445
|
my $json; |
203
|
|
|
|
|
|
|
{ |
204
|
0
|
|
|
|
|
0
|
local $/ = undef; |
|
13
|
|
|
|
|
850
|
|
205
|
13
|
|
|
|
|
6011
|
open(my $fh, '<', $self->patch_path . '/' . $file); |
206
|
13
|
|
|
|
|
518
|
$json = <$fh>; |
207
|
10
|
|
|
|
|
11787
|
close($fh); |
208
|
|
|
|
|
|
|
} |
209
|
10
|
50
|
|
|
|
597
|
$json=~s/\n|\r\n/ /gm unless $self->keep_newlines; |
210
|
13
|
|
|
|
|
65
|
my $patch_array = JSON::XS::decode_json($json); |
211
|
13
|
|
|
|
|
57
|
foreach my $patch (@$patch_array) { |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
my $status = $self->deployer_db->selectrow_hashref( |
214
|
13
|
|
|
|
|
57
|
(sprintf q|SELECT * FROM %s WHERE name = ?|, $self->deployer_patch_table),{},$patch->{name}); |
215
|
|
|
|
|
|
|
|
216
|
13
|
50
|
|
|
|
51
|
$self->record_patch($patch->{name}) unless $status; |
217
|
|
|
|
|
|
|
|
218
|
13
|
|
|
|
|
28
|
foreach (keys %$status) { |
219
|
13
|
|
|
|
|
69
|
$patch->{$_} = $status->{$_}; |
220
|
|
|
|
|
|
|
} |
221
|
13
|
|
|
|
|
28
|
$patch->{db} = $self->target_db; |
222
|
13
|
|
|
|
|
447
|
$patch->{supports_transactions} = $self->supports_transactions; |
223
|
10
|
|
|
|
|
59
|
$patches->{ $patch->{name} } = DBIx::Deployer::Patch->new( %$patch ); |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
} |
226
|
10
|
|
|
|
|
49
|
$self->_patches_hashref($patches); |
227
|
10
|
|
|
|
|
51
|
return $self->_patches_hashref; |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
|
230
|
1
|
50
|
|
1
|
|
227
|
method record_patch (Str $name) { |
|
1
|
50
|
|
13
|
|
1468
|
|
|
1
|
50
|
|
|
|
2
|
|
|
1
|
50
|
|
|
|
164
|
|
|
1
|
50
|
|
|
|
2547
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
22
|
|
|
10
|
|
|
|
|
54
|
|
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
83
|
|
|
10
|
|
|
|
|
28
|
|
|
10
|
|
|
|
|
292
|
|
|
30
|
|
|
|
|
1048
|
|
|
8
|
|
|
|
|
1709
|
|
231
|
8
|
50
|
|
|
|
21
|
$self->deployer_db->do( |
232
|
|
|
|
|
|
|
(sprintf q|INSERT INTO %s (name, deployed, verified) VALUES (?, ?, ?)|, $self->deployer_patch_table), |
233
|
|
|
|
|
|
|
{}, $name, 0, 0) or die $@; |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
1
|
50
|
|
1
|
|
140
|
method update_patch (InstanceOf['DBIx::Deployer::Patch'] $patch) { |
|
1
|
50
|
|
10
|
|
6
|
|
|
1
|
50
|
|
|
|
1
|
|
|
1
|
50
|
|
|
|
355
|
|
|
1
|
50
|
|
|
|
2780
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
|
8
|
|
|
|
|
30
|
|
|
8
|
|
|
|
|
339
|
|
|
9
|
|
|
|
|
64
|
|
|
7
|
|
|
|
|
135
|
|
|
13
|
|
|
|
|
208
|
|
|
13
|
|
|
|
|
61
|
|
|
13
|
|
|
|
|
66
|
|
237
|
|
|
|
|
|
|
$self->deployer_db->do( |
238
|
|
|
|
|
|
|
(sprintf q|UPDATE %s SET deployed = ?, verified = ? WHERE name = ?|, $self->deployer_patch_table), |
239
|
13
|
50
|
|
|
|
64
|
{}, map{ $patch->$_ } qw(deployed verified name) |
|
13
|
|
|
|
|
33
|
|
240
|
|
|
|
|
|
|
) or die $@; |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
|
243
|
1
|
50
|
|
1
|
|
134
|
method deploy_all { |
|
1
|
|
|
8
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
12
|
|
|
|
|
211
|
|
|
13
|
|
|
|
|
96
|
|
|
13
|
|
|
|
|
39
|
|
244
|
13
|
|
|
|
|
428
|
my $patches = $self->patches; |
245
|
11
|
|
|
|
|
140
|
foreach my $name (keys %$patches){ |
246
|
11
|
|
|
|
|
127
|
$self->deploy($patches->{$name}); |
247
|
|
|
|
|
|
|
} |
248
|
11
|
|
|
|
|
47
|
return true; |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
|
251
|
1
|
50
|
|
1
|
|
163
|
method deploy (InstanceOf['DBIx::Deployer::Patch'] $patch) { |
|
1
|
50
|
|
13
|
|
9637
|
|
|
1
|
50
|
|
|
|
17
|
|
|
1
|
50
|
|
|
|
3102
|
|
|
1
|
50
|
|
|
|
510
|
|
|
1
|
|
|
|
|
463
|
|
|
0
|
|
|
|
|
0
|
|
|
3
|
|
|
|
|
16
|
|
|
3
|
|
|
|
|
119
|
|
|
3
|
|
|
|
|
16
|
|
|
2
|
|
|
|
|
15
|
|
|
1
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
34
|
|
|
10
|
|
|
|
|
439
|
|
252
|
10
|
100
|
|
|
|
2315
|
return if $patch->deployed; |
253
|
|
|
|
|
|
|
|
254
|
10
|
100
|
|
|
|
114
|
my @dependencies = @{ $patch->dependencies || [] }; |
|
10
|
|
|
|
|
91676
|
|
255
|
|
|
|
|
|
|
|
256
|
1
|
100
|
|
|
|
29
|
if(@dependencies){ |
257
|
10
|
|
|
|
|
47
|
my $patches = $self->patches; |
258
|
10
|
|
|
|
|
44
|
foreach my $name (@dependencies){ |
259
|
10
|
100
|
|
|
|
48
|
if($patches->{$name}){ |
260
|
10
|
|
|
|
|
40
|
$self->deploy($patches->{$name}); |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
else{ |
263
|
10
|
|
|
|
|
18
|
die colored(['red'], q|Patch "| . $patch->name . qq|" failed: Patch dependency "$name" is not defined.|); |
264
|
|
|
|
|
|
|
} |
265
|
|
|
|
|
|
|
} |
266
|
|
|
|
|
|
|
} |
267
|
|
|
|
|
|
|
|
268
|
10
|
|
|
|
|
74
|
eval{ $patch->deploy }; |
|
10
|
|
|
|
|
26
|
|
269
|
10
|
|
|
|
|
188
|
my $error = $@; |
270
|
|
|
|
|
|
|
$self->update_patch($patch); |
271
|
|
100
|
|
|
|
|
if($error){ die $error; } |
272
|
|
|
|
|
|
|
} |
273
|
|
|
|
|
|
|
|
274
|
1
|
50
|
|
1
|
|
485
|
method _init (InstanceOf['DBI::db'] $db){ |
|
1
|
50
|
|
10
|
|
485
|
|
|
1
|
50
|
|
|
|
473
|
|
|
1
|
50
|
|
|
|
1539
|
|
|
1
|
50
|
|
|
|
881
|
|
|
12
|
|
|
|
|
61003
|
|
|
0
|
|
|
|
|
0
|
|
275
|
|
50
|
|
|
|
|
$db->do( |
276
|
|
|
|
|
|
|
(sprintf q|CREATE TABLE %s (name VARCHAR UNIQUE, deployed INT, verified INT)|, $self->deployer_patch_table) |
277
|
|
|
|
|
|
|
) or die $@; |
278
|
|
|
|
|
|
|
} |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
# ABSTRACT: Light-weight database patch utility |
282
|
|
|
|
|
|
|
# PODNAME: DBIx::Deployer |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
__END__ |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=pod |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=encoding UTF-8 |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=head1 NAME |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
DBIx::Deployer - Light-weight database patch utility |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=head1 VERSION |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
version v1.2.3 |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=head1 SYNOPSIS |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
use DBIx::Deployer; |
301
|
|
|
|
|
|
|
my $d = DBIx::Deployer->new( |
302
|
|
|
|
|
|
|
target_dsn => 'dbi:Sybase:server=foo;database=bar;', |
303
|
|
|
|
|
|
|
target_username => 'sa', |
304
|
|
|
|
|
|
|
target_password => '1234', |
305
|
|
|
|
|
|
|
patch_path => '../patches/', |
306
|
|
|
|
|
|
|
deployer_db_file => 'deployer.db', |
307
|
|
|
|
|
|
|
); |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
# Run all patches (skipping over those already deployed) |
310
|
|
|
|
|
|
|
$d->deploy_all; |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
# Run one patch (and its dependencies) |
313
|
|
|
|
|
|
|
my $patches = $d->patches; |
314
|
|
|
|
|
|
|
$d->deploy( $patches->{'the patch name'} ); |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
=head1 DESCRIPTION |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
Stop here. Go read about L<App::Sqitch> instead. |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
Still here? That's probably because your database isn't supported by Sqitch :(. This module is a super-lightweight patch management tool that uses SQLite (see L<DBD::SQLite>) to store whether a patch has been deployed and verified. |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
If you're wondering why I authored this and did not contribute to Sqitch, the answer is that I needed a quick and dirty solution to hold me over until I can use Sqitch after a database migration. |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
=head1 VERSIONING |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
Semantic versioning is adopted by this module. See L<http://semver.org/>. |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
=head2 target_db (DBI::db) |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
This is the database handle where patches will be deployed. You may optionally pass C<target_dsn>, C<target_username>, and C<target_password> as an alternative to C<target_db>. |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
=head2 target_dsn (Str) |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
This is the dsn for your database that you will be performing patch deployments upon. See L<DBI> for more information on dsn strings. |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
=head2 target_username (Str) |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
The username for your database. |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
=head2 target_password (Str) |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
The password for your database. |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
=head2 patch_path (Str REQUIRED) |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
The directory path where you will store your patch files. PLEASE NOTE: DBIx::Deployer will attempt to process *all* files in this directory as patches regardless of extension or naming convention. |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
=head2 deployer_db_file (Str) |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
This is the file path where you would like your DBIx::Deployer SQLite database to be stored. This is required if using SQLite to manage your patch information. |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
=head2 deployer_db (DBI::db) |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
If you want your patch status information to live in a database other than SQLite, pass a DBI::db object during instantiation. Your database storing the patches must have a table conforming to the following structure: |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=over 4 |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
=item |
361
|
|
|
|
|
|
|
* Table name: patches (you may specify a different table name by using the C<deployer_patch_table> attribute) |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
=item |
364
|
|
|
|
|
|
|
* Column: name VARCHAR (of acceptable length for patch names, recommended to be UNIQUE) |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
=item |
367
|
|
|
|
|
|
|
* Column: deployed BOOL/INT |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
=item |
370
|
|
|
|
|
|
|
* Column: verified BOOL/INT |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
=back |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
=head2 deployer_patch_table (Str OPTIONAL defaults to 'patches') |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
Set this attribute if you want patch data to be recorded in a table other than 'patches'. See C<deployer_db>. |
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
=head2 supports_transactions (Bool OPTIONAL defaults to true) |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
If your database supports transactions, C<deploy_sql> will be rolled back if verification fails, or if other errors occur during deployment of individual patches. If your database does not support transactions, you will need to set this attribute to false. Please be aware that without transactions, patches may find themselves in a state of being deployed but not verified... however, if that happens you'll likely have bigger fish to fry like figuring out how to repair your database. :) |
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
=head2 keep_newlines (Bool OPTIONAL defaults to false) |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
For convenience and SQL readability, newlines are allowed in the SQL string values in the JSON patch files contrary to the JSON specification. By default, these newlines will be converted to spaces before being passed to the parser. If for some reason these transformations must not be done, set this attribute to true. |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
=head1 METHODS |
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
=head2 deploy_all |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
This will process all patches in the C<patch_path>. Some things to note: |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
=over 4 |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
=item |
395
|
|
|
|
|
|
|
* C<deploy> is idempotent. It will not run patch files that have already been deployed. |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
=item |
398
|
|
|
|
|
|
|
* If your database supports transactions, failed patches will be rolled back. Please be aware that an entire patch file (think multiple SQL statements) will not be rolled back if a patch (think single SQL statement) within the file fails. |
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
=back |
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
=head2 patches |
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
This returns an array of DBIx::Deployer::Patch objects. This is only useful if your intent is to use these objects in conjunction with C<deploy>. |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
=head2 deploy (DBIx::Deployer::Patch REQUIRED) |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
This method deploys the patch passed as an argument AND its corresponding dependencies. |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
=head1 PATCH FILES |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
Patches are written as JSON arrays, and stored in the C<patch_path> directory. These files must be able to be parsed by JSON::XS. |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
# Patch Example |
415
|
|
|
|
|
|
|
[ |
416
|
|
|
|
|
|
|
{ |
417
|
|
|
|
|
|
|
"name":"insert into foo", |
418
|
|
|
|
|
|
|
"deploy_sql":"INSERT INTO foo VALUES (1, 2)", |
419
|
|
|
|
|
|
|
"verify_sql":"SELECT COUNT(*) FROM foo", |
420
|
|
|
|
|
|
|
"verify_expects":[ [1] ], |
421
|
|
|
|
|
|
|
"dependencies": [ "create table foo" ] |
422
|
|
|
|
|
|
|
}, |
423
|
|
|
|
|
|
|
{ |
424
|
|
|
|
|
|
|
"name":"create table foo", |
425
|
|
|
|
|
|
|
"deploy_sql":"CREATE TABLE foo(a,b)", |
426
|
|
|
|
|
|
|
"verify_sql":"PRAGMA table_info(foo)", |
427
|
|
|
|
|
|
|
"verify_expects":[ [ 0, "a", "", 0, null, 0 ], [ 1, "b", "", 0, null, 0 ] ] |
428
|
|
|
|
|
|
|
} |
429
|
|
|
|
|
|
|
] |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
=head2 Patch Attributes |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
=head3 name (Str REQUIRED) |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
The name of the patch must be unique. It will be used as the primary key for the patch, and is how you will declare it as a dependency for other patches. |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
=head3 dependencies (ArrayRef) |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
Dependencies are listed by name. Take care not to create circular dependencies as I have no intentions of protecting against them. |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
=head3 deploy_sql (Str) |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
Patch files may contain multiple patches, but a single patch within a patch file may not contain more than one SQL statement to deploy. |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
=head3 deploy_sql_args (ArrayRef) |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
If using bind parameters in your C<deploy_sql> statement, the values in C<deploy_sql_args> will be used for those parameters. See L<DBI> and L<http://www.bobby-tables.com> for more information about bind parameters. |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
=head3 deploy_script (Str) *EXPERIMENTAL* |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
The C<deploy_script> will be passed as an argument to the C<system> command. Scripts are expected to handle transactions on their own. A non-zero exit status is reported as a failure. |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
=head3 deploy_script_args (ArrayRef) *EXPERIMENTAL* |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
The C<deploy_script_args> are passed to the C<system> command with the C<deploy_script> in PROGRAM LIST syntax. It may be useful to manipulate this attribute at runtime to pass environment-specific arguments. |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
=head3 verify_sql (Str) |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
This is a single query used to sanity check that your C<deploy_sql> was successful. By default, this parameter is required. See C<no_verify> if your use case requires deployment without verification. |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
=head3 verify_sql_args (ArrayRef) |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
If using bind parameters in your C<verify_sql> statement, the values in C<verify_sql_args> will be used for those parameters. See L<DBI> and L<http://www.bobby-tables.com> for more information about bind parameters. |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
=head3 verify_expects (ArrayRef) |
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
The C<verify_sql> is selected using C<selectall_arrayref> (see L<DBI>). The C<verify_expects> attribute is a representation of the query result you would anticipate from the C<selectall_arrayref> method. |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
=head3 no_verify (Bool) |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
If set to true, patches will be marked verified WITHOUT having any tests run. |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
=head1 REPOSITORY |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
L<https://github.com/Camspi/DBIx-Deployer> |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
=head1 SEE ALSO |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
=over 4 |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
=item |
482
|
|
|
|
|
|
|
* L<App::Sqitch> - seriously, use this module instead |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
=item |
485
|
|
|
|
|
|
|
* L<DBD::SQLite> |
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
=item |
488
|
|
|
|
|
|
|
* L<DBI> |
489
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
=back |
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
=head1 CREDITS |
493
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
=over 4 |
495
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
=item |
497
|
|
|
|
|
|
|
* eMortgage Logic, LLC., for allowing me to publish this module to CPAN |
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
=back |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
=head1 AUTHOR |
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
Chris Tijerina |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
This software is copyright (c) 2014-2017 by eMortgage Logic LLC. |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
510
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
=cut |