DeploymentHandler/VersionStorage/Standard.pm

filter: Statementstmt 92.3% 24 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 2 totaltotal 83.3% 30 / 36 CC 1 SCAR 0.3
CC
1
Cov
92%
__ANON__
1.1
__ANON__
1.1
add_database_version
1.0
CRAP 1.0
« DeploymentHandler/WithApplicatorDumple.pm ↑ Summary DeploymentHandler/HandlesDeploy.pm »
1 package DBIx::Class::DeploymentHandler::VersionStorage::Standard;
2 11 $DBIx::Class::DeploymentHandler::VersionStorage::Standard::VERSION = '0.002235';
3 11 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use DBIx::Class::DeploymentHandler::LogImporter ':log';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # ABSTRACT: Version storage that does the normal stuff
7  
8 11 ▶use DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 11 has schema => (
11 is => 'ro',
12 required => 1,
13 );
14  
15 11 has version_source => (
16 is => 'ro',
17 default => '__VERSION',
18 );
19  
20 11 has version_class => (
21 is => 'ro',
22 default =>
23 'DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult',
24 );
25  
26 11 has version_rs => (
27 isa => 'DBIx::Class::ResultSet',
28 is => 'ro',
29 lazy => 1,
30 builder => '_build_version_rs',
31 handles => [qw( database_version version_storage_is_installed )],
32 );
33  
34 11 with 'DBIx::Class::DeploymentHandler::HandlesVersionStorage';
35  
36 33 ▶sub _build_version_rs {
Subroutine _build_version_rs: called CC=1 SCAR=0.0
37 33 $_[0]->schema->register_class(
38 $_[0]->version_source => $_[0]->version_class )->resultset;
39 }
40  
41 27 ▶sub add_database_version {
Subroutine add_database_version: called CC=1 SCAR=0.2
Pod undocumented
42 27 my $version = $_[1]->{version};
43 0 ▶ log_debug { "Adding database version $version" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
44 27 $_[0]->version_rs->create($_[1])
45 }
46  
47 7 ▶sub delete_database_version {
Subroutine delete_database_version: called CC=1 SCAR=0.2
Pod undocumented
48 7 my $version = $_[1]->{version};
49 0 ▶ log_debug { "Deleting database version $version" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
50 7 $_[0]->version_rs->search({ version => $version})->delete
51 }
52  
53 11 __PACKAGE__->meta->make_immutable;
54  
55 11 1;
56  
57 # vim: ts=2 sw=2 expandtab
58  
59 __END__
« DeploymentHandler/WithApplicatorDumple.pm ↑ Summary DeploymentHandler/HandlesDeploy.pm »