1 package DBIx::Class::DeploymentHandler::VersionHandler::Monotonic;
5 # ABSTRACT: Obvious version progressions
9 with 'DBIx::Class::DeploymentHandler::HandlesVersioning';
11 has schema_version => (
17 has database_version => (
29 sub _build_to_version { $_[0]->schema_version }
37 sub _inc_version { $_[0]->_version($_[0]->_version + 1 ) }
38 sub _dec_version { $_[0]->_version($_[0]->_version - 1 ) }
40 sub _build__version { $_[0]->database_version }
42 sub previous_version_set {
44 if ($self->to_version > $self->_version) {
45 croak "you are trying to downgrade and your current version is less\n".
46 "than the version you are trying to downgrade to. Either upgrade\n".
47 "or update your schema"
48 } elsif ( $self->to_version == $self->_version) {
52 return [$self->_version + 1, $self->_version];
56 sub next_version_set {
58 if ($self->to_version < $self->_version) {
59 croak "you are trying to upgrade and your current version is greater\n".
60 "than the version you are trying to upgrade to. Either downgrade\n".
61 "or update your schema"
62 } elsif ( $self->to_version == $self->_version) {
66 return [$self->_version - 1, $self->_version];
70 __PACKAGE__->meta->make_immutable;
74 # vim: ts=2 sw=2 expandtab
80 This class is an implementation of
81 L<DBIx::Class::DeploymentHandler::HandlesVersioning>. Pretty much all the
82 documentation is there.