From: Arthur Axel 'fREW' Schmidt Date: Tue, 13 Apr 2010 04:36:25 +0000 (-0500) Subject: rename prepare_install to be prepare_deploy X-Git-Tag: v0.001000_01~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=91557c90ba0b3f313696c2f15dd8b56fb8358574;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git rename prepare_install to be prepare_deploy --- diff --git a/TODO b/TODO index 0986456..e69de29 100644 --- a/TODO +++ b/TODO @@ -1 +0,0 @@ -pod diff --git a/lib/DBIx/Class/DeploymentHandler.pm b/lib/DBIx/Class/DeploymentHandler.pm index ba93b57..e7ffec9 100644 --- a/lib/DBIx/Class/DeploymentHandler.pm +++ b/lib/DBIx/Class/DeploymentHandler.pm @@ -47,7 +47,7 @@ __END__ sqltargs => { add_drop_table => 0 }, }); - $dh->prepare_install; + $dh->prepare_deploy; $dh->install; diff --git a/lib/DBIx/Class/DeploymentHandler/Dad.pm b/lib/DBIx/Class/DeploymentHandler/Dad.pm index 064c093..85757a9 100644 --- a/lib/DBIx/Class/DeploymentHandler/Dad.pm +++ b/lib/DBIx/Class/DeploymentHandler/Dad.pm @@ -94,7 +94,7 @@ The version (defaults to schema's version) to migrate the database to Deploys the current schema into the database. Populates C with C and C. -B: you typically need to call C<< $dh->prepare_install >> before you call +B: you typically need to call C<< $dh->prepare_deploy >> before you call this method. B: you cannot install on top of an already installed database @@ -169,9 +169,9 @@ should probably implement these too, even if they are no-ops. see L -=head2 prepare_install +=head2 prepare_deploy -see L +see L =head2 prepare_resultsource_install diff --git a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm index 6de2694..5dbc9f2 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm @@ -270,7 +270,7 @@ sub prepare_resultsource_install { }, $filename); } -sub prepare_install { +sub prepare_deploy { my $self = shift; $self->_prepare_install({}, '_ddl_schema_produce_filename'); } diff --git a/lib/DBIx/Class/DeploymentHandler/HandlesDeploy.pm b/lib/DBIx/Class/DeploymentHandler/HandlesDeploy.pm index feba373..4d4d818 100644 --- a/lib/DBIx/Class/DeploymentHandler/HandlesDeploy.pm +++ b/lib/DBIx/Class/DeploymentHandler/HandlesDeploy.pm @@ -3,14 +3,17 @@ use Moose::Role; # ABSTRACT: Interface for deploy methods -requires 'prepare_install'; +requires 'prepare_deploy'; +requires 'deploy'; + requires 'prepare_resultsource_install'; requires 'install_resultsource'; + requires 'prepare_upgrade'; -requires 'prepare_downgrade'; requires 'upgrade_single_step'; + +requires 'prepare_downgrade'; requires 'downgrade_single_step'; -requires 'deploy'; 1; @@ -18,11 +21,9 @@ requires 'deploy'; __END__ -=method prepare_install - - (should this be renamed prepare_deploy?) +=method prepare_deploy - $dh->prepare_install + $dh->prepare_deploy Generate the needed data files to install the schema to the database. diff --git a/t/02-instantiation.t b/t/02-instantiation.t index b302e98..5173da8 100644 --- a/t/02-instantiation.t +++ b/t/02-instantiation.t @@ -33,7 +33,7 @@ VERSION1: { ok($handler, 'DBIx::Class::DeploymentHandler w/1 instantiates correctly'); my $version = $s->schema_version; - $handler->prepare_install; + $handler->prepare_deploy; dies_ok { $s->resultset('Foo')->create({ @@ -65,7 +65,7 @@ VERSION2: { ok($handler, 'DBIx::Class::DeploymentHandler w/2 instantiates correctly'); my $version = $s->schema_version(); - $handler->prepare_install(); + $handler->prepare_deploy(); $handler->prepare_upgrade(1, $version); dies_ok { $s->resultset('Foo')->create({ @@ -102,7 +102,7 @@ VERSION3: { ok($handler, 'DBIx::Class::DeploymentHandler w/3 instantiates correctly'); my $version = $s->schema_version(); - $handler->prepare_install; + $handler->prepare_deploy; $handler->prepare_upgrade( 2, $version ); dies_ok { $s->resultset('Foo')->create({ diff --git a/t/03-deprecated.t b/t/03-deprecated.t index 00fcb52..5eb19d3 100644 --- a/t/03-deprecated.t +++ b/t/03-deprecated.t @@ -32,7 +32,7 @@ VERSION1: { ok($handler, 'DBIx::Class::DeploymentHandler w/1.0 instantiates correctly'); my $version = $s->schema_version(); - $handler->prepare_install(); + $handler->prepare_deploy(); dies_ok { $s->resultset('Foo')->create({ @@ -64,7 +64,7 @@ VERSION2: { ok($handler, 'DBIx::Class::DeploymentHandler w/2.0 instantiates correctly'); my $version = $s->schema_version(); - $handler->prepare_install(); + $handler->prepare_deploy(); $handler->prepare_upgrade('1.0', $version); dies_ok { $s->resultset('Foo')->create({ @@ -101,7 +101,7 @@ VERSION3: { ok($handler, 'DBIx::Class::DeploymentHandler w/3.0 instantiates correctly'); my $version = $s->schema_version(); - $handler->prepare_install; + $handler->prepare_deploy; $handler->prepare_upgrade( '2.0', $version ); dies_ok { $s->resultset('Foo')->create({ diff --git a/t/deploy_methods/sql_translator.t b/t/deploy_methods/sql_translator.t index eca08c8..26fc062 100644 --- a/t/deploy_methods/sql_translator.t +++ b/t/deploy_methods/sql_translator.t @@ -27,12 +27,12 @@ VERSION1: { ok( $dm, 'DBIC::DH::DM::SQL::Translator gets instantiated correctly' ); - $dm->prepare_install; + $dm->prepare_deploy; { my $warned = 0; local $SIG{__WARN__} = sub{$warned = 1}; - $dm->prepare_install; - ok( $warned, 'prepare_install warns if you run it twice' ); + $dm->prepare_deploy; + ok( $warned, 'prepare_deploy warns if you run it twice' ); } mkpath(catfile(qw( t sql _common schema 1.0 ))); open my $common, '>', @@ -78,13 +78,13 @@ VERSION2: { upgrade_directory => $sql_dir, databases => ['SQLite'], sqltargs => { add_drop_table => 0 }, - txn_wrap => 1, + txn_wrap => 1, }); ok( $dm, 'DBIC::DH::SQL::Translator w/2.0 instantiates correctly'); $version = $s->schema_version(); - $dm->prepare_install; + $dm->prepare_deploy; ok( -f catfile(qw( t sql SQLite schema 2.0 001-auto.sql )), '2.0 schema gets generated properly' @@ -130,14 +130,14 @@ VERSION2: { open my $common_pl, '>', catfile(qw( t sql _common up 1.0-2.0 003-semiautomatic.pl )); print {$common_pl} q| - sub run { - my $schema = shift; - $schema->resultset('Foo')->create({ - bar => 'goodbye', - baz => 'blue skies', - }) - } - |; + sub run { + my $schema = shift; + $schema->resultset('Foo')->create({ + bar => 'goodbye', + baz => 'blue skies', + }) + } + |; close $common_pl; $dm->upgrade_single_step([qw( 1.0 2.0 )]); @@ -179,7 +179,7 @@ VERSION3: { ok( $dm, 'DBIC::DH::SQL::Translator w/3.0 instantiates correctly'); $version = $s->schema_version(); - $dm->prepare_install; + $dm->prepare_deploy; ok( -f catfile(qw( t sql SQLite schema 3.0 001-auto.sql )), '2.0 schema gets generated properly' diff --git a/t/deploy_methods/sql_translator_deprecated.t b/t/deploy_methods/sql_translator_deprecated.t index b69d87a..1342a5f 100644 --- a/t/deploy_methods/sql_translator_deprecated.t +++ b/t/deploy_methods/sql_translator_deprecated.t @@ -6,7 +6,7 @@ use Test::Exception; use lib 't/lib'; use DBICDHTest; use aliased - 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated'; + 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated'; use File::Spec::Functions; @@ -28,7 +28,7 @@ VERSION1: { ok( $dm, 'DBIC::DH::DM::SQLT::Deprecated gets instantiated correctly' ); - $dm->prepare_install; + $dm->prepare_deploy; ok( -f catfile(qw( t sql DBICVersion-Schema-1.0-SQLite.sql )), @@ -49,8 +49,8 @@ VERSION1: { } VERSION2: { - use_ok 'DBICVersion_v2'; - my $s = DBICVersion::Schema->connect(@connection); + use_ok 'DBICVersion_v2'; + my $s = DBICVersion::Schema->connect(@connection); my $dm = Deprecated->new({ schema => $s, upgrade_directory => $sql_dir, @@ -58,32 +58,32 @@ VERSION2: { }); ok( - $dm, - 'DBIC::DH::DM::SQLT::Deprecated gets instantiated correctly w/ version 2.0' - ); + $dm, + 'DBIC::DH::DM::SQLT::Deprecated gets instantiated correctly w/ version 2.0' + ); - $version = $s->schema_version; - $dm->prepare_install; - $dm->prepare_upgrade('1.0', $version, ['1.0', $version]); - dies_ok { - $s->resultset('Foo')->create({ - bar => 'frew', - baz => 'frew', - }) - } 'schema not deployed'; - dies_ok { - $s->resultset('Foo')->create({ - bar => 'frew', - baz => 'frew', - }) - } 'schema not uppgrayyed'; - $dm->upgrade_single_step(['1.0', $version]); - lives_ok { - $s->resultset('Foo')->create({ - bar => 'frew', - baz => 'frew', - }) - } 'schema is deployed'; + $version = $s->schema_version; + $dm->prepare_deploy; + $dm->prepare_upgrade('1.0', $version, ['1.0', $version]); + dies_ok { + $s->resultset('Foo')->create({ + bar => 'frew', + baz => 'frew', + }) + } 'schema not deployed'; + dies_ok { + $s->resultset('Foo')->create({ + bar => 'frew', + baz => 'frew', + }) + } 'schema not uppgrayyed'; + $dm->upgrade_single_step(['1.0', $version]); + lives_ok { + $s->resultset('Foo')->create({ + bar => 'frew', + baz => 'frew', + }) + } 'schema is deployed'; } done_testing; #vim: ts=2 sw=2 expandtab