| 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
Condition66%2/3
defined $_ && length $_
MC/DC50%1/2
defined $_ && length $_
defined $_
length $_
Truth table66%2/3
A && B
A= defined $_B= length $_
| |||||||||||||||||||||||||||||
| 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"} // []
MC/DC100%1/1
$_->{"dependents"} // []
$_->{"dependents"}
Truth table100%2/2
A
A= $_->{"dependents"}
| |||||||||||||||||||||||||||||
| 21 | 3732 | ▶ | return unless @items; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||