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/VersionStorage/Deprecated.pm ↑ Summary DeploymentHandler/HandlesDeploy.pm »
1 package DBIx::Class::DeploymentHandler::VersionStorage::Standard;
2 11 $DBIx::Class::DeploymentHandler::VersionStorage::Standard::VERSION = '0.002233';
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 sub _build_version_rs {
37 33 ▶ $_[0]->schema->register_class(
Subroutine _build_version_rs: called CC=1 SCAR=0.0
38 $_[0]->version_source => $_[0]->version_class )->resultset;
39 }
40  
41 sub add_database_version {
42 27 ▶ my $version = $_[1]->{version};
Subroutine add_database_version: called CC=1 SCAR=0.2
Pod undocumented
43 27 ▶ 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 sub delete_database_version {
48 7 ▶ my $version = $_[1]->{version};
Subroutine delete_database_version: called CC=1 SCAR=0.2
Pod undocumented
49 7 ▶ 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__
60  
61 =pod
62  
63 =head1 NAME
64  
65 DBIx::Class::DeploymentHandler::VersionStorage::Standard - Version storage that does the normal stuff
66  
67 =head1 SEE ALSO
68  
69 This class is an implementation of
70 L<DBIx::Class::DeploymentHandler::HandlesVersionStorage>. Pretty much all the
71 documentation is there.
72  
73 =head1 AUTHOR
74  
75 Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
76  
77 =head1 COPYRIGHT AND LICENSE
78  
79 This software is copyright (c) 2019 by Arthur Axel "fREW" Schmidt.
80  
81 This is free software; you can redistribute it and/or modify it under
82 the same terms as the Perl 5 programming language system itself.
83  
84 =cut
« DeploymentHandler/VersionStorage/Deprecated.pm ↑ Summary DeploymentHandler/HandlesDeploy.pm »