From: Arthur Axel 'fREW' Schmidt Date: Sat, 27 Feb 2010 18:09:52 +0000 (-0600) Subject: DeployMethod should not know anything about versioning X-Git-Tag: v0.001000_01~104 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c3aec7c96abe4990fd1b1ac8f8f3b1358466411f;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git DeployMethod should not know anything about versioning --- diff --git a/lib/DBIx/Class/DeploymentHandler.pm b/lib/DBIx/Class/DeploymentHandler.pm index db13a93..6de3e7d 100644 --- a/lib/DBIx/Class/DeploymentHandler.pm +++ b/lib/DBIx/Class/DeploymentHandler.pm @@ -84,8 +84,15 @@ method install { } sub upgrade { - while ( my $version_list = $_[0]->next_version_set ) { - $_[0]->_upgrade_single_step($version_list); + my $self = shift; + while ( my $version_list = $self->next_version_set ) { + $self->_upgrade_single_step($version_list); + + $self->version_rs->create({ + version => $version_list->[-1], + # ddl => $ddl, + # upgrade_sql => $upgrade_sql, + }); } } diff --git a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm index 2591006..0f55471 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm @@ -33,18 +33,6 @@ has upgrade_directory => ( default => 'sql', ); -has version_rs => ( - isa => 'DBIx::Class::ResultSet', - is => 'ro', - lazy_build => 1, - handles => [qw( is_installed db_version )], -); - -method _build_version_rs { - $self->schema->set_us_up_the_bomb; - $self->schema->resultset('__VERSION') -} - has databases => ( coerce => 1, isa => 'DBIx::Class::DeploymentHandler::Databases', @@ -330,7 +318,6 @@ method _read_sql_file($file) { sub _upgrade_single_step { my $self = shift; my @version_set = @{ shift @_ }; - my $db_version = $self->db_version; my $upgrade_file = $self->_ddl_filename( $self->storage->sqlt_type, \@version_set, @@ -343,16 +330,8 @@ sub _upgrade_single_step { return; } - carp "DB version ($db_version) is lower than the schema version (".$self->schema_version."). Attempting upgrade.\n"; - $self->_filedata($self->_read_sql_file($upgrade_file)); # I don't like this --fREW 2010-02-22 $self->schema->txn_do(sub { $self->_do_upgrade }); - - $self->version_rs->create({ - version => $version_set[-1], - # ddl => $ddl, - # upgrade_sql => $upgrade_sql, - }); } method _do_upgrade { $self->_run_upgrade(qr/.*?/) }