X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class-DeploymentHandler.git;a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FDeploymentHandler%2FVersionHandler%2FDatabaseToSchemaVersions.pm;h=28b3b860e7f9051dc0513bc06d146458dcd3b6a7;hp=4adc416ae4f9c50e6a9f165d1ae0ededecb84191;hb=97aa9a748e07c9e5875d56bd7d6554e481911c5d;hpb=c703d15de5286961942f33cdeff6ad978c90d3de diff --git a/lib/DBIx/Class/DeploymentHandler/VersionHandler/DatabaseToSchemaVersions.pm b/lib/DBIx/Class/DeploymentHandler/VersionHandler/DatabaseToSchemaVersions.pm index 4adc416..28b3b86 100644 --- a/lib/DBIx/Class/DeploymentHandler/VersionHandler/DatabaseToSchemaVersions.pm +++ b/lib/DBIx/Class/DeploymentHandler/VersionHandler/DatabaseToSchemaVersions.pm @@ -1,9 +1,31 @@ package DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions; + use Moose; -use Method::Signatures::Simple; + +# ABSTRACT: Go straight from Database to Schema version with 'DBIx::Class::DeploymentHandler::HandlesVersioning'; +has schema_version => ( + isa => 'Str', + is => 'ro', + required => 1, +); + +has database_version => ( + isa => 'Str', + is => 'ro', + required => 1, +); + +has to_version => ( # configuration + is => 'ro', + isa => 'Str', + lazy_build => 1, +); + +sub _build_to_version { $_[0]->schema_version } + has once => ( is => 'rw', isa => 'Bool', @@ -17,8 +39,19 @@ sub next_version_set { $self->once(!$self->once); return undef - if $self->db_version eq $self->to_version; - return [$self->db_version, $self->to_version]; + if $self->database_version eq $self->to_version; + return [$self->database_version, $self->to_version]; +} + +sub previous_version_set { + my $self = shift; + return undef + if $self->once; + + $self->once(!$self->once); + return undef + if $self->database_version eq $self->to_version; + return [$self->database_version, $self->to_version]; } @@ -26,6 +59,12 @@ __PACKAGE__->meta->make_immutable; 1; +# vim: ts=2 sw=2 expandtab + __END__ -vim: ts=2 sw=2 expandtab +=head1 SEE ALSO + +This class is an implementation of +L. Pretty much all the +documentation is there.