From: Arthur Axel 'fREW' Schmidt Date: Sat, 20 Mar 2010 21:56:45 +0000 (-0500) Subject: rename set_us_up_the_bomb :-( X-Git-Tag: v0.001000_01~68 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6bbb6ce77c91be6cac19b0f9a888ba0bfcd7c3b4;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git rename set_us_up_the_bomb :-( make a tiny change that should allow this to work w/o component on Schema --- diff --git a/lib/DBIx/Class/DeploymentHandler.pm b/lib/DBIx/Class/DeploymentHandler.pm index 9431c0d..1690096 100644 --- a/lib/DBIx/Class/DeploymentHandler.pm +++ b/lib/DBIx/Class/DeploymentHandler.pm @@ -43,8 +43,7 @@ has backup_directory => ( # configuration has to_version => ( # configuration is => 'ro', - lazy_build => 1, # builder comes from another role... - # which is... probably not how we want it + lazy_build => 1, ); sub _build_to_version { $_[0]->schema->schema_version } @@ -71,7 +70,7 @@ method install { if ($new_version) { $self->_deploy; - $self->add_database_version({ + $self->version_storage->add_database_version({ version => $new_version, # ddl => $ddl, # upgrade_sql => $upgrade_sql, diff --git a/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard.pm b/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard.pm index c286ffe..88376d0 100644 --- a/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard.pm +++ b/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard.pm @@ -19,8 +19,11 @@ has version_rs => ( with 'DBIx::Class::DeploymentHandler::HandlesVersionStorage'; sub _build_version_rs { - $_[0]->schema->set_us_up_the_bomb; - $_[0]->schema->resultset('__VERSION') + $_[0]->schema->register_class( + __VERSION => + 'DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult' + ); + $_[0]->schema->resultset('__VERSION') } sub add_database_version { $_[0]->version_rs->create($_[1]) } diff --git a/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard/Component.pm b/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard/Component.pm index 6f03c72..ecf2e24 100644 --- a/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard/Component.pm +++ b/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard/Component.pm @@ -6,10 +6,8 @@ use warnings; use Carp 'carp'; use DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult; -sub set_us_up_the_bomb { - my $self = shift; - - $self->register_class( +sub attach_version_storage { + $_[0]->register_class( __VERSION => 'DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult' ); } @@ -18,7 +16,7 @@ sub connection { my $self = shift; $self->next::method(@_); - $self->set_us_up_the_bomb; + $self->attach_version_storage; my $args = $_[3] || {}; @@ -32,6 +30,7 @@ sub connection { ', your database contains version ' . $versions->db_version . ", please call upgrade on your Schema.\n"; } } + return $self; }