File Coverage

blib/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard.pm
Criterion Covered Total %
statement 16 18 88.8
branch n/a
condition n/a
subroutine 6 8 75.0
pod 0 2 0.0
total 22 28 78.5


line stmt bran cond sub pod time code
1             package DBIx::Class::DeploymentHandler::VersionStorage::Standard;
2             $DBIx::Class::DeploymentHandler::VersionStorage::Standard::VERSION = '0.002231';
3 10     10   196584 use Moose;
  10         481192  
  10         77  
4 10     10   67263 use DBIx::Class::DeploymentHandler::LogImporter ':log';
  10         30  
  10         109  
5              
6             # ABSTRACT: Version storage that does the normal stuff
7              
8 10     10   5225 use DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult;
  10         46  
  10         3248  
9              
10             has schema => (
11             is => 'ro',
12             required => 1,
13             );
14              
15             has version_source => (
16             is => 'ro',
17             default => '__VERSION',
18             );
19              
20             has version_class => (
21             is => 'ro',
22             default =>
23             'DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult',
24             );
25              
26             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             with 'DBIx::Class::DeploymentHandler::HandlesVersionStorage';
35              
36             sub _build_version_rs {
37 28     28   1170 $_[0]->schema->register_class(
38             $_[0]->version_source => $_[0]->version_class )->resultset;
39             }
40              
41             sub add_database_version {
42 24     24 0 4988 my $version = $_[1]->{version};
43 24     0   218 log_debug { "Adding database version $version" };
  0         0  
44 24         1780 $_[0]->version_rs->create($_[1])
45             }
46              
47             sub delete_database_version {
48 5     5 0 83 my $version = $_[1]->{version};
49 5     0   43 log_debug { "Deleting database version $version" };
  0         0  
50 5         361 $_[0]->version_rs->search({ version => $version})->delete
51             }
52              
53             __PACKAGE__->meta->make_immutable;
54              
55             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