tiny bit of cleanup and rename create_install_ddl to prepare_install
Arthur Axel 'fREW' Schmidt [Sat, 27 Feb 2010 10:13:36 +0000 (04:13 -0600)]
lib/DBIx/Class/DeploymentHandler.pm
lib/DBIx/Class/DeploymentHandler/SqltDeployMethod.pm
lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm
t/02-instantiation.t
t/03_explict_versions.t
t/04_db_schema_versions.t

index 965ed0f..66e6259 100644 (file)
@@ -58,11 +58,6 @@ has to_version => (
   lazy_build => 1,
 );
 
-method _build_version_rs {
-   $self->schema->set_us_up_the_bomb;
-   $self->schema->resultset('__VERSION')
-}
-
 has databases => ( # configuration
   coerce  => 1,
   isa     => 'DBIx::Class::DeploymentHandler::Databases',
index e807ace..4977910 100644 (file)
@@ -75,7 +75,7 @@ has _filedata => (
 );
 
 method ddl_filename($type, $versions, $dir) {
-  my $filename = ref($self->schema);
+  my $filename = ref $self->schema;
   $filename =~ s/::/-/g;
 
   $filename = File::Spec->catfile(
@@ -159,7 +159,7 @@ method deploy {
   }
 }
 
-method create_install_ddl {
+method prepare_install {
   my $schema    = $self->schema;
   my $databases = $self->databases;
   my $dir       = $self->upgrade_directory;
@@ -318,7 +318,7 @@ method create_update_ddl($version, $preversion) {
 }
 
 method create_ddl_dir($version, $preversion) {
-  $self->create_install_ddl;
+  $self->prepare_install;
   $self->create_update_ddl($version, $preversion) if $preversion;
 }
 
index 79d1a2d..06f6f14 100644 (file)
@@ -19,25 +19,25 @@ has deploy_method => (
   handles => [qw{
     deployment_statements
     deploy
-        create_install_ddl
-        create_update_ddl
-        create_ddl_dir
-        upgrade_single_step
+   prepare_install
+   create_update_ddl
+   create_ddl_dir
+   upgrade_single_step
   }],
 );
 
 sub _build_deploy_method {
-       my $self = shift;
-       my $args = {
-               schema            => $self->schema,
-               databases         => $self->databases,
-               upgrade_directory => $self->upgrade_directory,
-               sqltargs          => $self->sqltargs,
-               do_backup         => $self->do_backup,
-       };
-       $args->{backup_directory} = $self->backup_directory
-               if $self->has_backup_directory;
-       DBIx::Class::DeploymentHandler::SqltDeployMethod->new($args);
+  my $self = shift;
+  my $args = {
+    schema            => $self->schema,
+    databases         => $self->databases,
+    upgrade_directory => $self->upgrade_directory,
+    sqltargs          => $self->sqltargs,
+    do_backup         => $self->do_backup,
+  };
+  $args->{backup_directory} = $self->backup_directory
+    if $self->has_backup_directory;
+  DBIx::Class::DeploymentHandler::SqltDeployMethod->new($args);
 }
 
 1;
index 73e92de..c7fde9b 100644 (file)
@@ -31,7 +31,7 @@ VERSION1: {
    ok($handler, 'DBIx::Class::DeploymentHandler w/1.0 instantiates correctly');
 
    my $version = $s->schema_version();
-   $handler->create_install_ddl();
+   $handler->prepare_install();
    ok(-e 't/sql/DBICVersion-Schema-1.0-SQLite.sql', 'DDL for 1.0 got created successfully');
 
    dies_ok {
@@ -60,7 +60,7 @@ VERSION2: {
    ok($handler, 'DBIx::Class::DeploymentHandler w/2.0 instantiates correctly');
 
    $version = $s->schema_version();
-   $handler->create_install_ddl();
+   $handler->prepare_install();
    $handler->create_update_ddl($version, '1.0');
    ok(-e 't/sql/DBICVersion-Schema-2.0-SQLite.sql', 'DDL for 2.0 got created successfully');
    ok(-e 't/sql/DBICVersion-Schema-1.0-2.0-SQLite.sql', 'DDL for migration from 1.0 to 2.0 got created successfully');
@@ -99,7 +99,7 @@ VERSION3: {
    ok($handler, 'DBIx::Class::DeploymentHandler w/3.0 instantiates correctly');
 
    $version = $s->schema_version();
-   $handler->create_install_ddl;
+   $handler->prepare_install;
    $handler->create_update_ddl( $version, '1.0');
    $handler->create_update_ddl( $version, '2.0');
    ok(-e 't/sql/DBICVersion-Schema-3.0-SQLite.sql', 'DDL for 3.0 got created successfully');
index 1c5c05a..d5aa657 100644 (file)
@@ -29,7 +29,7 @@ my $handler = DBIx::Class::DeploymentHandler->new({
 });
 
 my $version = $s->schema_version();
-$handler->create_install_ddl();
+$handler->prepare_install();
 
 $handler->install;
 
index 87d770e..7c6ec46 100644 (file)
@@ -29,7 +29,7 @@ my $handler = DBIx::Class::DeploymentHandler->new({
 });
 
 my $version = $s->schema_version();
-$handler->create_install_ddl();
+$handler->prepare_install();
 
 $handler->install;
 {