File Coverage

blib/lib/DBIx/ThinSQL/Drop.pm
Criterion Covered Total %
statement 23 37 62.1
branch 2 2 100.0
condition n/a
subroutine 7 14 50.0
pod n/a
total 32 53 60.3


line stmt bran cond sub pod time code
1             package DBIx::ThinSQL::Drop;
2 2     2   707 use strict;
  2         2  
  2         67  
3 2     2   5 use warnings;
  2         2  
  2         43  
4 2     2   803 use File::ShareDir qw/dist_dir/;
  2         9054  
  2         134  
5 2     2   768 use Path::Tiny;
  2         7917  
  2         83  
6 2     2   394 use DBIx::ThinSQL::Deploy;
  2         3  
  2         467  
7              
8             our $VERSION = '0.0.45_1';
9              
10             sub _doit {
11 29     29   42 my $self = shift;
12 29         45 my $type = shift;
13 29         295 my $driver = $self->{Driver}->{Name};
14 29         188 my $file = $self->share_dir->child( 'Drop', $driver, $type . '.sql' );
15              
16 29 100       4226 return $self->run_file($file) if -f $file;
17 1         195 Carp::croak "Drop $type for driver $driver is unsupported.";
18             }
19              
20             sub DBIx::ThinSQL::db::drop_indexes {
21 0     0   0 my $self = shift;
22 0         0 return _doit( $self, 'indexes' );
23             }
24              
25             sub DBIx::ThinSQL::db::drop_functions {
26 0     0   0 my $self = shift;
27 0         0 return _doit( $self, 'functions' );
28             }
29              
30             sub DBIx::ThinSQL::db::drop_languages {
31 0     0   0 my $self = shift;
32 0         0 return _doit( $self, 'languages' );
33             }
34              
35             sub DBIx::ThinSQL::db::drop_sequences {
36 0     0   0 my $self = shift;
37 0         0 return _doit( $self, 'sequences' );
38             }
39              
40             sub DBIx::ThinSQL::db::drop_tables {
41 0     0   0 my $self = shift;
42 0         0 return _doit( $self, 'tables' );
43             }
44              
45             sub DBIx::ThinSQL::db::drop_triggers {
46 0     0   0 my $self = shift;
47 0         0 return _doit( $self, 'triggers' );
48             }
49              
50             sub DBIx::ThinSQL::db::drop_views {
51 0     0   0 my $self = shift;
52 0         0 return _doit( $self, 'views' );
53             }
54              
55             sub DBIx::ThinSQL::db::drop_everything {
56 5     5   59788 my $self = shift;
57 5         19 return _doit( $self, 'indexes' ) +
58             _doit( $self, 'functions' ) +
59             _doit( $self, 'languages' ) +
60             _doit( $self, 'sequences' ) +
61             _doit( $self, 'tables' ) +
62             _doit( $self, 'triggers' ) +
63             _doit( $self, 'views' );
64             }
65              
66             1;