From: Arthur Axel 'fREW' Schmidt Date: Sat, 27 Feb 2010 10:48:34 +0000 (-0600) Subject: comments for clarity and move backup stuff out of DM X-Git-Tag: v0.001000_01~106 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e217d19c58c8beba917e751dd1089281fa1a74ee;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git comments for clarity and move backup stuff out of DM --- diff --git a/lib/DBIx/Class/DeploymentHandler.pm b/lib/DBIx/Class/DeploymentHandler.pm index 2acfa0d..c22b6ab 100644 --- a/lib/DBIx/Class/DeploymentHandler.pm +++ b/lib/DBIx/Class/DeploymentHandler.pm @@ -24,7 +24,6 @@ has schema => ( isa => 'DBIx::Class::Schema', is => 'ro', required => 1, - handles => [qw( ddl_filename schema_version )], ); has upgrade_directory => ( # configuration @@ -49,13 +48,15 @@ has do_backup => ( # configuration has version_rs => ( isa => 'DBIx::Class::ResultSet', is => 'ro', - lazy_build => 1, - handles => [qw( is_installed db_version )], + lazy_build => 1, # builder comes from another role... + # which is... probably not how we want it + handles => [qw( is_installed )], ); -has to_version => ( +has to_version => ( # configuration is => 'ro', - lazy_build => 1, + lazy_build => 1, # builder comes from another role... + # which is... probably not how we want it ); has databases => ( # configuration @@ -94,6 +95,8 @@ sub upgrade { } } +method backup { $self->storage->backup($self->backup_directory) } + __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 bc7ed29..2591006 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm @@ -21,17 +21,6 @@ method _build_storage { $s } -has backup_directory => ( - isa => 'Str', - is => 'ro', -); - -has do_backup => ( - isa => 'Bool', - is => 'ro', - default => undef, -); - has sqltargs => ( isa => 'HashRef', is => 'ro', @@ -357,7 +346,6 @@ sub _upgrade_single_step { 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->backup if $self->do_backup; $self->schema->txn_do(sub { $self->_do_upgrade }); $self->version_rs->create({ @@ -385,8 +373,6 @@ method _apply_statement($statement) { $self->storage->dbh->do($_) or carp "SQL was: $_" } -method backup { $self->storage->backup($self->backup_directory) } - __PACKAGE__->meta->make_immutable; 1;