make DeployMethod deploy methods public for unversioned use-case
[dbsrgits/DBIx-Class-DeploymentHandler.git] / lib / DBIx / Class / DeploymentHandler / VersionHandler / DatabaseToSchemaVersions.pm
CommitLineData
c703d15d 1package DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions;
e70a1600 2use Moose;
3use Method::Signatures::Simple;
4
24794769 5with 'DBIx::Class::DeploymentHandler::HandlesVersioning';
2440e311 6
b539a216 7has schema_version => (
8 isa => 'Str',
9 is => 'ro',
10 required => 1,
11);
12
13has database_version => (
14 isa => 'Str',
15 is => 'ro',
16 required => 1,
17);
18
19has to_version => ( # configuration
20 is => 'ro',
21 lazy_build => 1, # builder comes from another role...
22 # which is... probably not how we want it
23);
24
25sub _build_to_version { $_[0]->schema_version }
26
24794769 27has once => (
28 is => 'rw',
29 isa => 'Bool',
30 default => undef,
e70a1600 31);
32
24794769 33sub next_version_set {
34 my $self = shift;
35 return undef
36 if $self->once;
e70a1600 37
24794769 38 $self->once(!$self->once);
39 return undef
fb105cfa 40 if $self->database_version eq $self->to_version;
41 return [$self->database_version, $self->to_version];
e70a1600 42}
43
e70a1600 44
45__PACKAGE__->meta->make_immutable;
46
471;
48
49__END__
50
51vim: ts=2 sw=2 expandtab