use a builder for schema_version so the user can specify it if need be
[dbsrgits/DBIx-Class-DeploymentHandler.git] / lib / DBIx / Class / DeploymentHandler / Dad.pm
index 8b6b8c4..f948f21 100644 (file)
@@ -1,5 +1,7 @@
 package DBIx::Class::DeploymentHandler::Dad;
 
+# ABSTRACT: Parent class for DeploymentHandlers
+
 use Moose;
 use Method::Signatures::Simple;
 require DBIx::Class::Schema;    # loaded for type constraint
@@ -9,7 +11,6 @@ has schema => (
   isa      => 'DBIx::Class::Schema',
   is       => 'ro',
   required => 1,
-  handles => ['schema_version'],
 );
 
 has backup_directory => (
@@ -25,6 +26,13 @@ has to_version => (
 
 sub _build_to_version { $_[0]->schema->schema_version }
 
+has schema_version => (
+  is         => 'ro',
+  lazy_build => 1,
+);
+
+sub _build_schema_version { $_[0]->schema->schema_version }
+
 method install {
   croak 'Install not possible as versions table already exists in database'
     if $self->version_storage_is_installed;
@@ -79,7 +87,7 @@ and generate the DDL.
 
 =attr backup_directory
 
-The directory that backups are stored in
+The directory where backups are stored
 
 =attr to_version
 
@@ -92,7 +100,7 @@ The version (defaults to schema's version) to migrate the database to
 Deploys the current schema into the database.  Populates C<version_storage> with
 C<version> and C<ddl>.
 
-B<Note>: you typically need to call C<< $dh->prepare_install >> before you call
+B<Note>: you typically need to call C<< $dh->prepare_deploy >> before you call
 this method.
 
 B<Note>: you cannot install on top of an already installed database
@@ -167,9 +175,9 @@ should probably implement these too, even if they are no-ops.
 
 see L<DBIx::Class::DeploymentHandler::HandlesVersionStorage/database_version>
 
-=head2 prepare_install
+=head2 prepare_deploy
 
-see L<DBIx::Class::DeploymentHandler::HandlesDeploy/prepare_install>
+see L<DBIx::Class::DeploymentHandler::HandlesDeploy/prepare_deploy>
 
 =head2 prepare_resultsource_install
 
@@ -187,8 +195,6 @@ see L<DBIx::Class::DeploymentHandler::HandlesDeploy/prepare_upgrade>
 
 see L<DBIx::Class::DeploymentHandler::HandlesDeploy/prepare_downgrade>
 
-=back
-
 =head2 SUBCLASSING
 
 All of the methods mentioned in L</METHODS THAT ARE REQUIRED IN SUBCLASSES> and