DeploymentHandler/VersionStorage/Deprecated/VersionResultSet.pm

filter: Statementstmt 100% 30 / 30 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 100% 3 / 3 totaltotal 100% 42 / 42 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« DeploymentHandler/VersionStorage/Deprecated/VersionResult.pm ↑ Summary DeploymentHandler/VersionStorage/Standard/VersionResultSet.pm »
1 package DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VersionResultSet;
2 1 $DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VersionResultSet::VERSION = '0.002233';
3 # ABSTRACT: (DEPRECATED) Predefined searches to find what you want from the version storage
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use parent 'DBIx::Class::ResultSet';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Time::HiRes 'gettimeofday';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 sub version_storage_is_installed {
14 2 ▶ my $self = shift;
Subroutine version_storage_is_installed: called CC=1 SCAR=0.0
Pod documented
15 2 ▶ try { $self->count; 1 } catch { undef }
Subroutine __ANON__: called CC=1 SCAR=0.0
16 2 }
17  
18 sub database_version {
19 2 ▶ my $self = shift;
Subroutine database_version: called CC=1 SCAR=0.0
Pod documented
20 2 $self->search(undef, {
21 order_by => { -desc => 'installed' },
22 rows => 1
23 })->get_column('version')->next;
24 }
25  
26 # this is why it's deprecated guys... Serially.
27 sub create {
28 3 ▶ my $self = shift;
Subroutine create: called CC=1 SCAR=0.0
Pod documented
29 3 my $args = shift;
30  
31 3 my @tm = gettimeofday();
32 3 my @dt = gmtime ($tm[0]);
33  
34 $self->next::method({
35 3 %{$args},
36 installed => sprintf("v%04d%02d%02d_%02d%02d%02d.%03.0f",
37 $dt[5] + 1900,
38 $dt[4] + 1,
39 $dt[3],
40 $dt[2],
41 $dt[1],
42 $dt[0],
43 $tm[1] / 1000, # convert to millisecs, format as up/down rounded int above
44 ),
45 });
46 }
47  
48 1 1;
49  
50 # vim: ts=2 sw=2 expandtab
51  
52 __END__
53  
54 =pod
55  
56 =head1 NAME
57  
58 DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VersionResultSet - (DEPRECATED) Predefined searches to find what you want from the version storage
59  
60 =head1 DEPRECATED
61  
62 This component has been suplanted by
63 L<DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResultSet>.
64 In the next major version (1) we will begin issuing a warning on it's use.
65 In the major version after that (2) we will remove it entirely.
66  
67 =head1 METHODS
68  
69 =head2 version_storage_is_installed
70  
71 True if (!!!) the version storage has been installed
72  
73 =head2 database_version
74  
75 The version of the database
76  
77 =head2 create
78  
79 Overridden to default C<installed> to the current time. (take a look, it's yucky)
80  
81 =head1 AUTHOR
82  
83 Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
84  
85 =head1 COPYRIGHT AND LICENSE
86  
87 This software is copyright (c) 2019 by Arthur Axel "fREW" Schmidt.
88  
89 This is free software; you can redistribute it and/or modify it under
90 the same terms as the Perl 5 programming language system itself.
91  
92 =cut
« DeploymentHandler/VersionStorage/Deprecated/VersionResult.pm ↑ Summary DeploymentHandler/VersionStorage/Standard/VersionResultSet.pm »