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