File Coverage

lib/DBIx/Schema/Changelog/Action/Index.pm
Criterion Covered Total %
statement 19 21 90.4
branch 1 4 25.0
condition n/a
subroutine 7 7 100.0
pod 3 3 100.0
total 30 35 85.7


line stmt bran cond sub pod time code
1             package DBIx::Schema::Changelog::Action::Index;
2              
3             =head1 NAME
4              
5             DBIx::Schema::Changelog::Action::Index - Action handler for indices
6              
7             =head1 VERSION
8              
9             Version 0.7.1
10              
11             =cut
12              
13             our $VERSION = '0.7.1';
14              
15 5     5   797 use strict;
  5         8  
  5         216  
16 5     5   23 use warnings;
  5         9  
  5         143  
17 5     5   22 use Moose;
  5         5  
  5         68  
18              
19             with 'DBIx::Schema::Changelog::Action';
20              
21             =head1 SUBROUTINES/METHODS
22              
23             =over 4
24              
25             =item add
26            
27             If it's supported new index will be created.
28              
29             =cut
30              
31             sub add {
32 1     1 1 2 my ( $self, $params ) = @_;
33 1         32 my $actions = $self->driver()->actions;
34              
35 1 50       4 unless ( $actions->{create_index} ) {
36 1         277 print STDERR __PACKAGE__, " (", __LINE__,
37             ") Create index is not supported! ", $/;
38 1         8 return;
39             }
40              
41 0 0       0 my $sql = _replace_spare(
42             $actions->{create_index},
43             [
44             ( ( defined $params->{name} ) ? $params->{name} : time() ),
45             $params->{taple}, $params->{using}, join( ", ", $params->{column} )
46             ]
47             );
48 0         0 $self->_do($sql);
49             }
50              
51             =item alter
52              
53             Not needed!
54              
55             =cut
56              
57 1     1 1 621 sub alter { }
58              
59             =item drop
60            
61             Not needed!
62              
63             =cut
64              
65 1     1 1 3 sub drop { }
66              
67 5     5   29629 no Moose;
  5         12  
  5         24  
68             __PACKAGE__->meta->make_immutable;
69              
70             1;
71              
72             __END__
73              
74             =back
75              
76             =head1 AUTHOR
77              
78             Mario Zieschang, C<< <mario.zieschang at combase.de> >>
79              
80             =head1 LICENSE AND COPYRIGHT
81              
82             Copyright 2015 Mario Zieschang.
83              
84             This program is free software; you can redistribute it and/or modify it
85             under the terms of the the Artistic License (2.0). You may obtain a
86             copy of the full license at:
87              
88             L<http://www.perlfoundation.org/artistic_license_2_0>
89              
90             Any use, modification, and distribution of the Standard or Modified
91             Versions is governed by this Artistic License. By using, modifying or
92             distributing the Package, you accept this license. Do not use, modify,
93             or distribute the Package, if you do not accept this license.
94              
95             If your Modified Version has been derived from a Modified Version made
96             by someone other than you, you are nevertheless required to ensure that
97             your Modified Version complies with the requirements of this license.
98              
99             This license does not grant you the right to use any trademark, service
100             mark, trade name, or logo of the Copyright Holder.
101              
102             This license includes the non-exclusive, worldwide, free-of-charge
103             patent license to make, have made, use, offer to sell, sell, import and
104             otherwise transfer the Package with respect to any patent claims
105             licensable by the Copyright Holder that are necessarily infringed by the
106             Package. If you institute patent litigation (including a cross-claim or
107             counterclaim) against any party alleging that the Package constitutes
108             direct or contributory patent infringement, then this Artistic License
109             to you shall terminate on the date that such litigation is filed.
110              
111             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
112             AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
113             THE IMPLIED WARRANTIES OF MERCHANT ABILITY, FITNESS FOR A PARTICULAR
114             PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
115             YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
116             CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
117             CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
118             EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
119              
120             =cut