DeploymentHandler/VersionStorage/Standard/Component.pm

filter: Statementstmt 100% 25 / 25 Branchbran 83.3% 5 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 88.6% 39 / 44 SCAR 16.1
CC
5
Cov
94%
connection
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 5.0
« DeploymentHandler/VersionHandler/Monotonic.pm ↑ Summary DeploymentHandler/Deprecated.pm »
1 package DBIx::Class::DeploymentHandler::VersionStorage::Standard::Component;
2 16 $DBIx::Class::DeploymentHandler::VersionStorage::Standard::Component::VERSION = '0.002231';
3 # ABSTRACT: Attach this component to your schema to ensure you stay up to date
4  
5 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 16 ▶use Carp 'carp';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 16 ▶use DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub attach_version_storage {
12 40 ▶ $_[0]->register_class(
Subroutine attach_version_storage: called CC=1 SCAR=0.0
Pod undocumented
13 __VERSION => 'DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult'
14 );
15 }
16  
17 sub connection {
18 40 ▶ my $self = shift;
Subroutine connection: called CC=5 SCAR=16.2
Pod undocumented
19 40 $self->next::method(@_);
20  
21 40 $self->attach_version_storage;
22  
23 40 my $args = $self->storage->_dbic_connect_attributes;
24  
25 40 ▶ unless ( $args->{ignore_version} || $ENV{DBIC_NO_VERSION_CHECK}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($args->{"ignore_version"} or $ENV{"DBIC_NO_VERSION_CHECK"}) 2 38 40
Condition66%2/3
$args->{"ignore_version"} or $ENV{"DBIC_NO_VERSION_CHECK"}
l!l&&r!l&&!r
3802
MC/DC50%1/2
$args->{"ignore_version"} or $ENV{"DBIC_NO_VERSION_CHECK"}
$args->{"ignore_version"} $ENV{"DBIC_NO_VERSION_CHECK"}
Truth table66%2/3
A or B
A= $args->{"ignore_version"}B= $ENV{"DBIC_NO_VERSION_CHECK"}
ABresult
1X1
011
000
26 2 my $versions = $self->resultset('__VERSION');
27  
28 2 ▶ if (!$versions->version_storage_is_installed) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $versions->version_storage_is_installed) { } 1 1 2
elsif ($versions->database_version ne $self->schema_version) { } 1 0 1
29 1 carp "Your DB is currently unversioned. Please call upgrade on your schema to sync the DB.\n";
30 } elsif ($versions->database_version ne $self->schema_version) {
31 1 carp 'Versions out of sync. This is ' . $self->schema_version .
32 ', your database contains version ' . $versions->database_version . ", please call upgrade on your Schema.\n";
33 }
34 }
35  
36 40 return $self;
37 }
38  
39 16 1;
40  
41 # vim: ts=2 sw=2 expandtab
42  
43 __END__
44  
45 =pod
46  
47 =head1 NAME
48  
49 DBIx::Class::DeploymentHandler::VersionStorage::Standard::Component - Attach this component to your schema to ensure you stay up to date
50  
51 =head1 AUTHOR
52  
53 Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
54  
55 =head1 COPYRIGHT AND LICENSE
56  
57 This software is copyright (c) 2019 by Arthur Axel "fREW" Schmidt.
58  
59 This is free software; you can redistribute it and/or modify it under
60 the same terms as the Perl 5 programming language system itself.
61  
62 =cut
« DeploymentHandler/VersionHandler/Monotonic.pm ↑ Summary DeploymentHandler/Deprecated.pm »