Commit | Line | Data |
e70a1600 |
1 | package DBIx::Class::DeploymentHandler::DatabaseToSchemaVersions; |
2 | use Moose; |
3 | use Method::Signatures::Simple; |
4 | |
2440e311 |
5 | # normally a VersionHandler will take |
6 | # a to_version and yeild an iterator of |
7 | # "version sets" or something like that. |
8 | # |
9 | # A "version set" is basically an arrayref |
10 | # of "version numbers" (which we already know |
11 | # is vague as is.) Typically an call to a |
12 | # VH w/ a db version of 1 and a "to_version" |
13 | # of 5 will iterate over something like this: |
14 | # [1, 2] |
15 | # [2, 3] |
16 | # [3, 4] |
17 | # [4, 5] |
18 | # |
19 | # Of course rob wants to be able to have dep |
20 | # management with his versions, so I *think* his |
21 | # would work like this: |
22 | # |
23 | # to_version = 7, db_version = 1 |
24 | # [1] |
25 | # [5] |
26 | # [7] |
27 | # |
28 | # Because 7 depended on 5, 5 was installed first; |
29 | # note that this potentially never released module |
30 | # doesn't use version pairs, instead it just yeilds |
31 | # versions. Version pairs are too much work for users |
32 | # to have to deal with in that sitation. We may |
33 | # actually switch to this for other versioners. |
34 | # |
35 | # The upshot of all this is that the DeploymentMethod |
36 | # needs to be able to take an ArrayRef[VersionNumber], |
37 | # instead of just a pair of VersionNumber. |
38 | |
e70a1600 |
39 | has schema => ( |
40 | isa => 'DBIx::Class::Schema', |
41 | is => 'ro', |
42 | required => 1, |
43 | handles => [qw( ddl_filename schema_version )], |
44 | ); |
45 | |
46 | has version_rs => ( |
47 | isa => 'DBIx::Class::ResultSet', |
48 | is => 'ro', |
49 | lazy_build => 1, |
50 | handles => [qw( is_installed db_version )], |
51 | ); |
52 | |
53 | method _build_version_rs { |
54 | $self->schema->set_us_up_the_bomb; |
55 | $self->schema->resultset('__VERSION') |
56 | } |
57 | |
58 | method ordered_schema_versions { |
59 | ( $self->db_version, $self->schema_version) |
60 | } |
61 | |
62 | __PACKAGE__->meta->make_immutable; |
63 | |
64 | 1; |
65 | |
66 | __END__ |
67 | |
68 | vim: ts=2 sw=2 expandtab |