From: Arthur Axel 'fREW' Schmidt Date: Wed, 24 Feb 2010 04:57:54 +0000 (-0600) Subject: add in role I forget X-Git-Tag: v0.001000_01~130 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8bf3eee179f8cc5c1765a83a18dd15c7ac9f26bd;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git add in role I forget add predicate for backup_directory --- diff --git a/lib/DBIx/Class/DeploymentHandler.pm b/lib/DBIx/Class/DeploymentHandler.pm index c67fb92..c40b5d3 100644 --- a/lib/DBIx/Class/DeploymentHandler.pm +++ b/lib/DBIx/Class/DeploymentHandler.pm @@ -40,6 +40,7 @@ has upgrade_directory => ( has backup_directory => ( isa => 'Str', is => 'ro', + predicate => 'has_backup_directory', ); has storage => ( diff --git a/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm b/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm new file mode 100644 index 0000000..ab0dc76 --- /dev/null +++ b/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm @@ -0,0 +1,37 @@ +package DBIx::Class::DeploymentHandler::WithSqltDeployMethod; +use Moose::Role; + +use DBIx::Class::DeploymentHandler::SqltDeployMethod; + +use Carp 'carp'; + +has deploy_method => ( + isa => 'DBIx::Class::DeploymentHandler::SqltDeployMethod', + is => 'ro', + lazy_build => 1, + handles => [qw{ + deployment_statements + deploy + create_install_ddl + create_update_ddl + create_ddl_dir + upgrade_single_step + }], +); + +sub _build_deploy_method { + my $self = shift; + my $args = { + schema => $self->schema, + databases => $self->databases, + upgrade_directory => $self->upgrade_directory, + sqltargs => $self->sqltargs, + storage => $self->storage, + do_backup => $self->do_backup, + }; + $args->{backup_directory} = $self->backup_directory + if $self->has_backup_directory; + DBIx::Class::DeploymentHandler::SqltDeployMethod->new($args); +} + +1;