Commit | Line | Data |
01342998 |
1 | package DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VersionResultSet; |
2 | |
0fa93773 |
3 | # ABSTRACT: (DEPRECATED) Predefined searches to find what you want from the version storage |
4 | |
01342998 |
5 | use strict; |
6 | use warnings; |
7 | |
8 | use parent 'DBIx::Class::ResultSet'; |
9 | |
10 | use Try::Tiny; |
11 | use Time::HiRes 'gettimeofday'; |
12 | |
13 | sub version_storage_is_installed { |
14 | my $self = shift; |
15 | try { $self->next; 1 } catch { undef } |
16 | } |
17 | |
18 | sub 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. |
27 | sub 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 | |
48 | 1; |
49 | |
e52174e3 |
50 | # vim: ts=2 sw=2 expandtab |
51 | |
01342998 |
52 | __END__ |
53 | |
e068a12a |
54 | =head1 DEPRECATED |
55 | |
56 | This component has been suplanted by |
57 | L<DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResultSet>. |
58 | In the next major version (1) we will begin issuing a warning on it's use. |
59 | In the major version after that (2) we will remove it entirely. |
60 | |
0fa93773 |
61 | =method version_storage_is_installed |
62 | |
63 | True if (!!!) the version storage has been installed |
64 | |
65 | =method database_version |
66 | |
67 | The version of the database |
68 | |
69 | =method create |
70 | |
71 | Overridden to default C<installed> to the current time. (take a look, it's yucky) |
e068a12a |
72 | |
73 | |