blib/lib/DBIO/PostgreSQL/Diff/Dependents.pm

filter: Statementstmt 100% 21 / 21 Branchbran 100% 4 / 4 Conditioncond 80.0% 4 / 5 MC/DCmcdc 66.6% 2 / 3 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 94.7% 36 / 38 CC 5 SCAR 9.2
CC
5
Cov
97%
_describe
3.0
refuse
3.0
BEGIN
1.0
CRAP 2.5
« blib/lib/DBIO/PostgreSQL/Result.pm ↑ Summary blib/lib/DBIO/PostgreSQL/JSONB/Op.pm »
1 package DBIO::PostgreSQL::Diff::Dependents;
2 # ABSTRACT: A drop that meets objects outside the model is refused, naming them
3  
4 106 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 106 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 106 our $VERSION = '0.900007';
8  
9  
10  
11 12 ▶sub _describe {
Subroutine _describe: called CC=3 SCAR=11.0
12 12 my ($dependent) = @_;
13 26 ▶ return join ' ', grep { defined && length }
Branch: 1 branch
BranchTrueFalseTotal
defined $dependent->{'on'} ? : 2 10 12
Condition66%2/3
defined $_ && length $_
!ll&&!rl&&r
1025
MC/DC50%1/2
defined $_ && length $_
defined $_ length $_
Truth table66%2/3
A && B
A= defined $_B= length $_
ABresult
0X0
100
111
14 $dependent->{kind}, $dependent->{name},
15 12 (defined $dependent->{on} ? "on $dependent->{on}" : ());
16 }
17  
18 3732 ▶sub refuse {
Subroutine refuse: called CC=3 SCAR=11.0
Pod documented
19 3732 my ($class, @items) = @_;
20 3732 ▶ @items = grep { @{ $_->{dependents} // [] } } @items;
Condition100%2/2
$_->{"dependents"} // []
l!l
554
MC/DC100%1/1
$_->{"dependents"} // []
$_->{"dependents"}
Truth table100%2/2
A
A= $_->{"dependents"}
Aresult
11
00
21 3732 ▶ return unless @items;
Branch: 1 branch
BranchTrueFalseTotal
unless @items 3728 4 3732
22  
23 die join "\n",
24 ( map {
25 4 my $item = $_;
26 ( sprintf('refusing to diff: %s is not in the target and would be dropped, and these objects outside the deploy depend on it:',
27 $item->{object}),
28 5 ( map { ' ' . _describe($_) } @{ $item->{dependents} } ),
29 '' )
30 } @items ),
31 'The drop is written without CASCADE, so nothing outside the deploy goes with it.',
32 'No statement was generated.',
33 '',
34 'Change or drop these yourself, or keep the object in the target, and diff again.',
35 '';
36 }
37  
38 106 1;
39  
40 __END__
« blib/lib/DBIO/PostgreSQL/Result.pm ↑ Summary blib/lib/DBIO/PostgreSQL/JSONB/Op.pm »