From: Arthur Axel 'fREW' Schmidt Date: Wed, 17 Mar 2010 05:49:05 +0000 (-0500) Subject: make DeployHandler use VersionStorage X-Git-Tag: v0.001000_01~98 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=973d060d37345288521092cf85a080bd3e16e1a0;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git make DeployHandler use VersionStorage --- diff --git a/lib/DBIx/Class/DeploymentHandler.pm b/lib/DBIx/Class/DeploymentHandler.pm index 6de3e7d..76d48e0 100644 --- a/lib/DBIx/Class/DeploymentHandler.pm +++ b/lib/DBIx/Class/DeploymentHandler.pm @@ -6,8 +6,9 @@ require DBIx::Class::Schema; # loaded for type constraint require DBIx::Class::ResultSet; # loaded for type constraint use Carp::Clan '^DBIx::Class::DeploymentHandler'; -with 'DBIx::Class::DeploymentHandler::WithSqltDeployMethod'; -with 'DBIx::Class::DeploymentHandler::WithDatabaseToSchemaVersions'; +with 'DBIx::Class::DeploymentHandler::WithSqltDeployMethod', + 'DBIx::Class::DeploymentHandler::WithDatabaseToSchemaVersions', + 'DBIx::Class::DeploymentHandler::WithStandardVersionStorage'; BEGIN { use Moose::Util::TypeConstraints; @@ -39,14 +40,6 @@ has backup_directory => ( # configuration predicate => 'has_backup_directory', ); -has version_rs => ( - isa => 'DBIx::Class::ResultSet', - is => 'ro', - lazy_build => 1, # builder comes from another role... - # which is... probably not how we want it - handles => [qw( is_installed )], -); - has to_version => ( # configuration is => 'ro', lazy_build => 1, # builder comes from another role... @@ -68,14 +61,14 @@ has sqltargs => ( # configuration method install { carp 'Install not possible as versions table already exists in database' - if $self->is_installed; + if $self->version_storage_is_installed; my $new_version = $self->to_version; if ($new_version) { $self->_deploy; - $self->version_rs->create({ + $self->add_database_version({ version => $new_version, # ddl => $ddl, # upgrade_sql => $upgrade_sql, @@ -88,7 +81,7 @@ sub upgrade { while ( my $version_list = $self->next_version_set ) { $self->_upgrade_single_step($version_list); - $self->version_rs->create({ + $self->add_database_version({ version => $version_list->[-1], # ddl => $ddl, # upgrade_sql => $upgrade_sql,