1 package DBIx::Class::DeploymentHandler::VersionHandler::Monotonic;
4 # ABSTRACT: Obvious version progressions
8 with 'DBIx::Class::DeploymentHandler::HandlesVersioning';
10 has schema_version => (
16 has database_version => (
28 sub _build_to_version { $_[0]->schema_version }
36 sub _inc_version { $_[0]->_version($_[0]->_version + 1 ) }
37 sub _dec_version { $_[0]->_version($_[0]->_version - 1 ) }
39 sub _build__version { $_[0]->database_version }
41 sub previous_version_set {
43 if ($self->to_version > $self->_version) {
44 croak "you are trying to downgrade and your current version is less\n".
45 "than the version you are trying to downgrade to. Either upgrade\n".
46 "or update your schema"
47 } elsif ( $self->to_version == $self->_version) {
51 return [$self->_version, $self->_version + 1];
55 sub next_version_set {
57 if ($self->to_version < $self->_version) {
58 croak "you are trying to upgrade and your current version is greater\n".
59 "than the version you are trying to upgrade to. Either downgrade\n".
60 "or update your schema"
61 } elsif ( $self->to_version == $self->_version) {
65 return [$self->_version - 1, $self->_version];
69 __PACKAGE__->meta->make_immutable;
73 # vim: ts=2 sw=2 expandtab