various doc
[dbsrgits/DBIx-Class-DeploymentHandler.git] / lib / DBIx / Class / DeploymentHandler / VersionStorage / Deprecated / VersionResultSet.pm
CommitLineData
01342998 1package DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VersionResultSet;
2
0fa93773 3# ABSTRACT: (DEPRECATED) Predefined searches to find what you want from the version storage
4
01342998 5use strict;
6use warnings;
7
8use parent 'DBIx::Class::ResultSet';
9
10use Try::Tiny;
11use Time::HiRes 'gettimeofday';
12
13sub version_storage_is_installed {
14 my $self = shift;
15 try { $self->next; 1 } catch { undef }
16}
17
18sub database_version {
19 my $self = shift;
20 $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.
27sub create {
28 my $self = shift;
fe3b6dff 29 my $args = shift;
01342998 30
31 my @tm = gettimeofday();
32 my @dt = gmtime ($tm[0]);
33
34 $self->next::method({
fe3b6dff 35 %{$args},
01342998 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
481;
49
e52174e3 50# vim: ts=2 sw=2 expandtab
51
01342998 52__END__
53
0fa93773 54=method version_storage_is_installed
55
56True if (!!!) the version storage has been installed
57
58=method database_version
59
60The version of the database
61
62=method create
63
64Overridden to default C<installed> to the current time. (take a look, it's yucky)