more and more todo
[dbsrgits/DBIx-Class-DeploymentHandler.git] / lib / DBIx / Class / DeploymentHandler / VersionStorage / Deprecated / VersionResultSet.pm
CommitLineData
01342998 1package DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VersionResultSet;
2
3use strict;
4use warnings;
5
6use parent 'DBIx::Class::ResultSet';
7
8use Try::Tiny;
9use Time::HiRes 'gettimeofday';
10
11sub version_storage_is_installed {
12 my $self = shift;
13 try { $self->next; 1 } catch { undef }
14}
15
16sub database_version {
17 my $self = shift;
18 $self->search(undef, {
19 order_by => { -desc => 'installed' },
20 rows => 1
21 })->get_column('version')->next;
22}
23
24# this is why it's deprecated guys... Serially.
25sub create {
26 my $self = shift;
27
28 my @tm = gettimeofday();
29 my @dt = gmtime ($tm[0]);
30
31 $self->next::method({
32 version => $version,
33 installed => sprintf("v%04d%02d%02d_%02d%02d%02d.%03.0f",
34 $dt[5] + 1900,
35 $dt[4] + 1,
36 $dt[3],
37 $dt[2],
38 $dt[1],
39 $dt[0],
40 $tm[1] / 1000, # convert to millisecs, format as up/down rounded int above
41 ),
42 });
43}
44
451;
46
47__END__
48
49vim: ts=2 sw=2 expandtab