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