From: Arthur Axel 'fREW' Schmidt Date: Sat, 27 Feb 2010 10:13:36 +0000 (-0600) Subject: tiny bit of cleanup and rename create_install_ddl to prepare_install X-Git-Tag: v0.001000_01~113 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a912450b8ca3f98fa8ef136ec40c77817e6cf4c9;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git tiny bit of cleanup and rename create_install_ddl to prepare_install --- diff --git a/lib/DBIx/Class/DeploymentHandler.pm b/lib/DBIx/Class/DeploymentHandler.pm index 965ed0f..66e6259 100644 --- a/lib/DBIx/Class/DeploymentHandler.pm +++ b/lib/DBIx/Class/DeploymentHandler.pm @@ -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', diff --git a/lib/DBIx/Class/DeploymentHandler/SqltDeployMethod.pm b/lib/DBIx/Class/DeploymentHandler/SqltDeployMethod.pm index e807ace..4977910 100644 --- a/lib/DBIx/Class/DeploymentHandler/SqltDeployMethod.pm +++ b/lib/DBIx/Class/DeploymentHandler/SqltDeployMethod.pm @@ -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; } diff --git a/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm b/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm index 79d1a2d..06f6f14 100644 --- a/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm +++ b/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm @@ -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; diff --git a/t/02-instantiation.t b/t/02-instantiation.t index 73e92de..c7fde9b 100644 --- a/t/02-instantiation.t +++ b/t/02-instantiation.t @@ -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'); diff --git a/t/03_explict_versions.t b/t/03_explict_versions.t index 1c5c05a..d5aa657 100644 --- a/t/03_explict_versions.t +++ b/t/03_explict_versions.t @@ -29,7 +29,7 @@ my $handler = DBIx::Class::DeploymentHandler->new({ }); my $version = $s->schema_version(); -$handler->create_install_ddl(); +$handler->prepare_install(); $handler->install; diff --git a/t/04_db_schema_versions.t b/t/04_db_schema_versions.t index 87d770e..7c6ec46 100644 --- a/t/04_db_schema_versions.t +++ b/t/04_db_schema_versions.t @@ -29,7 +29,7 @@ my $handler = DBIx::Class::DeploymentHandler->new({ }); my $version = $s->schema_version(); -$handler->create_install_ddl(); +$handler->prepare_install(); $handler->install; {