From: Arthur Axel 'fREW' Schmidt Date: Sat, 27 Mar 2010 08:28:53 +0000 (-0500) Subject: upgrade sql should work now X-Git-Tag: v0.001000_01~46 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=392a5ccc70419c87f72c5600e09a7a5697ac9002;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git upgrade sql should work now --- diff --git a/lib/DBIx/Class/DeploymentHandler/Dad.pm b/lib/DBIx/Class/DeploymentHandler/Dad.pm index 2c19b3d..d1a4f83 100644 --- a/lib/DBIx/Class/DeploymentHandler/Dad.pm +++ b/lib/DBIx/Class/DeploymentHandler/Dad.pm @@ -62,18 +62,22 @@ method install { sub upgrade { my $self = shift; while ( my $version_list = $self->next_version_set ) { - $self->_upgrade_single_step($version_list); + my ($ddl, $upgrade_sql) = @{$self->_upgrade_single_step($version_list)||[]}; $self->add_database_version({ version => $version_list->[-1], - # ddl => $ddl, - # upgrade_sql => $upgrade_sql, + ddl => $ddl, + upgrade_sql => $upgrade_sql, }); } } method backup { $self->storage->backup($self->backup_directory) } +method deploy_version_storage { + $self-> +} + __PACKAGE__->meta->make_immutable; 1; diff --git a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm index 00953d8..92f54b5 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm @@ -372,12 +372,16 @@ sub _upgrade_single_step { \@version_set, )}; + my $upgrade_sql; for my $upgrade_file (@upgrade_files) { - $self->_filedata($self->_read_sql_file($upgrade_file)); # I don't like this --fREW 2010-02-22 + my $up = $self->_read_sql_file($upgrade_file); + $upgrade_sql .= $up; + $self->_filedata($up); # I don't like this --fREW 2010-02-22 my $guard = $self->schema->txn_scope_guard if $self->txn_wrap; $self->_do_upgrade; $guard->commit if $self->txn_wrap; } + return ['', $upgrade_sql]; } method _do_upgrade { $self->_run_upgrade(qr/.*?/) }