line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Schema::Changelog::Changeset; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
DBIx::Schema::Changelog::Changeset - Handles action types. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Version 0.7.1 |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.7.1'; |
14
|
|
|
|
|
|
|
|
15
|
5
|
|
|
5
|
|
755
|
use strict; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
182
|
|
16
|
5
|
|
|
5
|
|
19
|
use warnings; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
128
|
|
17
|
5
|
|
|
5
|
|
41044
|
use Moose; |
|
5
|
|
|
|
|
1954867
|
|
|
5
|
|
|
|
|
43
|
|
18
|
5
|
|
|
5
|
|
31624
|
use Method::Signatures::Simple; |
|
5
|
|
|
|
|
41774
|
|
|
5
|
|
|
|
|
36
|
|
19
|
5
|
|
|
5
|
|
4361
|
use MooseX::HasDefaults::RO; |
|
5
|
|
|
|
|
50822
|
|
|
5
|
|
|
|
|
44
|
|
20
|
5
|
|
|
5
|
|
40819
|
use DBIx::Schema::Changelog::Action::Sql; |
|
5
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
295
|
|
21
|
5
|
|
|
5
|
|
3012
|
use DBIx::Schema::Changelog::Action::Function; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
203
|
|
22
|
5
|
|
|
5
|
|
2676
|
use DBIx::Schema::Changelog::Action::Entry; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
199
|
|
23
|
5
|
|
|
5
|
|
36
|
use Data::Dumper; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
453
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has driver => (); |
26
|
|
|
|
|
|
|
has dbh => (); |
27
|
|
|
|
|
|
|
has table_action => ( isa => 'DBIx::Schema::Changelog::Action::Table', ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has sql_action => ( |
30
|
|
|
|
|
|
|
lazy => 1, |
31
|
|
|
|
|
|
|
does => 'DBIx::Schema::Changelog::Action', |
32
|
|
|
|
|
|
|
default => method { |
33
|
|
|
|
|
|
|
DBIx::Schema::Changelog::Action::Sql->new( |
34
|
|
|
|
|
|
|
driver => $self->driver(), |
35
|
|
|
|
|
|
|
dbh => $self->dbh() |
36
|
|
|
|
|
|
|
) |
37
|
|
|
|
|
|
|
}, |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has seq_action => ( |
41
|
|
|
|
|
|
|
is => 'rw', |
42
|
|
|
|
|
|
|
lazy => 1, |
43
|
|
|
|
|
|
|
does => 'DBIx::Schema::Changelog::Action', |
44
|
|
|
|
|
|
|
default => method { |
45
|
|
|
|
|
|
|
DBIx::Schema::Changelog::Action::Sequence->new( |
46
|
|
|
|
|
|
|
driver => $self->driver(), |
47
|
|
|
|
|
|
|
dbh => $self->dbh() |
48
|
|
|
|
|
|
|
) |
49
|
|
|
|
|
|
|
}, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
has index_action => ( |
53
|
|
|
|
|
|
|
lazy => 1, |
54
|
|
|
|
|
|
|
does => 'DBIx::Schema::Changelog::Action', |
55
|
|
|
|
|
|
|
default => method { |
56
|
|
|
|
|
|
|
DBIx::Schema::Changelog::Action::Index->new( |
57
|
|
|
|
|
|
|
driver => $self->driver(), |
58
|
|
|
|
|
|
|
dbh => $self->dbh() |
59
|
|
|
|
|
|
|
) |
60
|
|
|
|
|
|
|
}, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has view_action => ( |
64
|
|
|
|
|
|
|
lazy => 1, |
65
|
|
|
|
|
|
|
does => 'DBIx::Schema::Changelog::Action', |
66
|
|
|
|
|
|
|
default => method { |
67
|
|
|
|
|
|
|
DBIx::Schema::Changelog::Action::View->new( |
68
|
|
|
|
|
|
|
driver => $self->driver(), |
69
|
|
|
|
|
|
|
dbh => $self->dbh() |
70
|
|
|
|
|
|
|
) |
71
|
|
|
|
|
|
|
}, |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
has trigger_action => ( |
75
|
|
|
|
|
|
|
lazy => 1, |
76
|
|
|
|
|
|
|
does => 'DBIx::Schema::Changelog::Action', |
77
|
|
|
|
|
|
|
default => method { |
78
|
|
|
|
|
|
|
DBIx::Schema::Changelog::Action::Trigger->new( |
79
|
|
|
|
|
|
|
driver => $self->driver(), |
80
|
|
|
|
|
|
|
dbh => $self->dbh() |
81
|
|
|
|
|
|
|
) |
82
|
|
|
|
|
|
|
}, |
83
|
|
|
|
|
|
|
); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
has funct_action => ( |
86
|
|
|
|
|
|
|
lazy => 1, |
87
|
|
|
|
|
|
|
does => 'DBIx::Schema::Changelog::Action', |
88
|
|
|
|
|
|
|
default => method { |
89
|
|
|
|
|
|
|
DBIx::Schema::Changelog::Action::Function->new( |
90
|
|
|
|
|
|
|
driver => $self->driver(), |
91
|
|
|
|
|
|
|
dbh => $self->dbh() |
92
|
|
|
|
|
|
|
) |
93
|
|
|
|
|
|
|
}, |
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
|
96
|
13
|
|
|
13
|
1
|
26
|
has entry_action => ( |
97
|
13
|
|
|
|
|
42
|
lazy => 1, |
98
|
22
|
50
|
|
|
|
423
|
does => 'DBIx::Schema::Changelog::Action', |
99
|
|
|
|
|
|
|
default => method { |
100
|
|
|
|
|
|
|
DBIx::Schema::Changelog::Action::Entry->new( |
101
|
22
|
100
|
|
|
|
806
|
driver => $self->driver(), |
102
|
22
|
100
|
|
|
|
620857
|
dbh => $self->dbh() |
103
|
22
|
100
|
|
|
|
90086
|
) |
104
|
|
|
|
|
|
|
}, |
105
|
|
|
|
|
|
|
); |
106
|
22
|
100
|
|
|
|
60160
|
|
107
|
22
|
50
|
|
|
|
78
|
=head1 SUBROUTINES/METHODS |
108
|
22
|
50
|
|
|
|
75
|
|
109
|
|
|
|
|
|
|
=over 4 |
110
|
|
|
|
|
|
|
|
111
|
22
|
100
|
|
|
|
162
|
=item handle |
112
|
22
|
50
|
|
|
|
45406
|
|
113
|
22
|
50
|
|
|
|
67
|
Handles different changeset commands |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
116
|
22
|
50
|
|
|
|
66
|
|
117
|
22
|
50
|
|
|
|
111
|
sub handle { |
118
|
22
|
50
|
|
|
|
55
|
my ( $self, $entries ) = @_; |
119
|
|
|
|
|
|
|
foreach (@$entries) { |
120
|
|
|
|
|
|
|
die "No type set for changeset" . Dumper($_) unless $_->{type}; |
121
|
22
|
50
|
|
|
|
94
|
|
122
|
22
|
50
|
|
|
|
72
|
# table actions |
123
|
22
|
50
|
|
|
|
98
|
$self->table_action()->add($_) if ( $_->{type} eq 'createtable' ); |
124
|
|
|
|
|
|
|
$self->table_action()->drop($_) if ( $_->{type} eq 'droptable' ); |
125
|
|
|
|
|
|
|
$self->table_action()->alter($_) if ( $_->{type} eq 'altertable' ); |
126
|
22
|
50
|
|
|
|
62
|
|
127
|
22
|
50
|
|
|
|
103
|
# index actions |
128
|
22
|
50
|
|
|
|
100
|
$self->index_action()->add($_) if ( $_->{type} eq 'createindex' ); |
129
|
|
|
|
|
|
|
$self->index_action()->alter($_) if ( $_->{type} eq 'alterindex' ); |
130
|
|
|
|
|
|
|
$self->index_action()->drop($_) if ( $_->{type} eq 'dropindex' ); |
131
|
22
|
100
|
|
|
|
155
|
|
132
|
|
|
|
|
|
|
# view actions |
133
|
|
|
|
|
|
|
$self->view_action()->add($_) if ( $_->{type} eq 'createview' ); |
134
|
22
|
50
|
|
|
|
333
|
$self->view_action()->alter($_) if ( $_->{type} eq 'alterview' ); |
135
|
22
|
50
|
|
|
|
108
|
$self->view_action()->drop($_) if ( $_->{type} eq 'dropview' ); |
136
|
22
|
50
|
|
|
|
162
|
|
137
|
|
|
|
|
|
|
# sequence actions |
138
|
|
|
|
|
|
|
$self->seq_action()->add($_) if ( $_->{type} eq 'createsequence' ); |
139
|
|
|
|
|
|
|
$self->seq_action()->alter($_) if ( $_->{type} eq 'altersequence' ); |
140
|
5
|
|
|
5
|
|
10799
|
$self->seq_action()->drop($_) if ( $_->{type} eq 'dropsequence' ); |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
32
|
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
# function actions |
143
|
|
|
|
|
|
|
$self->funct_action()->add($_) if ( $_->{type} eq 'createfunction' ); |
144
|
|
|
|
|
|
|
$self->funct_action()->alter($_) if ( $_->{type} eq 'alterfunction' ); |
145
|
|
|
|
|
|
|
$self->funct_action()->drop($_) if ( $_->{type} eq 'dropfunction' ); |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
# function actions |
148
|
|
|
|
|
|
|
$self->trigger_action()->add($_) if ( $_->{type} eq 'createtrigger' ); |
149
|
|
|
|
|
|
|
$self->trigger_action()->alter($_) if ( $_->{type} eq 'altertrigger' ); |
150
|
|
|
|
|
|
|
$self->trigger_action()->drop($_) if ( $_->{type} eq 'droptrigger' ); |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
# manually called sql statement |
153
|
|
|
|
|
|
|
$self->sql_action()->add($_) if ( $_->{type} eq 'sql' ); |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
# entry statements |
156
|
|
|
|
|
|
|
$self->entry_action()->add($_) if ( $_->{type} eq 'insert' ); |
157
|
|
|
|
|
|
|
$self->entry_action()->add($_) if ( $_->{type} eq 'set' ); |
158
|
|
|
|
|
|
|
$self->entry_action()->add($_) if ( $_->{type} eq 'delete' ); |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
no Moose; |
163
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
1; # End of DBIx::Schema::Changelog::Changeset |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
__END__ |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=back |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 AUTHOR |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Mario Zieschang, C<< <mario.zieschang at combase.de> >> |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Copyright 2015 Mario Zieschang. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
180
|
|
|
|
|
|
|
under the terms of the the Artistic License (2.0). You may obtain a |
181
|
|
|
|
|
|
|
copy of the full license at: |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
L<http://www.perlfoundation.org/artistic_license_2_0> |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Any use, modification, and distribution of the Standard or Modified |
186
|
|
|
|
|
|
|
Versions is governed by this Artistic License. By using, modifying or |
187
|
|
|
|
|
|
|
distributing the Package, you accept this license. Do not use, modify, |
188
|
|
|
|
|
|
|
or distribute the Package, if you do not accept this license. |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
If your Modified Version has been derived from a Modified Version made |
191
|
|
|
|
|
|
|
by someone other than you, you are nevertheless required to ensure that |
192
|
|
|
|
|
|
|
your Modified Version complies with the requirements of this license. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
This license does not grant you the right to use any trademark, service |
195
|
|
|
|
|
|
|
mark, trade name, or logo of the Copyright Holder. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
This license includes the non-exclusive, worldwide, free-of-charge |
198
|
|
|
|
|
|
|
patent license to make, have made, use, offer to sell, sell, import and |
199
|
|
|
|
|
|
|
otherwise transfer the Package with respect to any patent claims |
200
|
|
|
|
|
|
|
licensable by the Copyright Holder that are necessarily infringed by the |
201
|
|
|
|
|
|
|
Package. If you institute patent litigation (including a cross-claim or |
202
|
|
|
|
|
|
|
counterclaim) against any party alleging that the Package constitutes |
203
|
|
|
|
|
|
|
direct or contributory patent infringement, then this Artistic License |
204
|
|
|
|
|
|
|
to you shall terminate on the date that such litigation is filed. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER |
207
|
|
|
|
|
|
|
AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. |
208
|
|
|
|
|
|
|
THE IMPLIED WARRANTIES OF MERCHANT ABILITY, FITNESS FOR A PARTICULAR |
209
|
|
|
|
|
|
|
PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY |
210
|
|
|
|
|
|
|
YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR |
211
|
|
|
|
|
|
|
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR |
212
|
|
|
|
|
|
|
CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, |
213
|
|
|
|
|
|
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=cut |