notes on how this should be done when I refactor completely
[dbsrgits/DBIx-Class-DeploymentHandler.git] / lib / DBIx / Class / DeploymentHandler / WithSqltDeployMethod.pm
1 package DBIx::Class::DeploymentHandler::WithSqltDeployMethod;
2 use Moose::Role;
3
4 use DBIx::Class::DeploymentHandler::SqltDeployMethod;
5
6 use Carp 'carp';
7
8 has deploy_method => (
9
10 # < mst> isa => 'DBIx::Class::DeploymentHandler::SqltDeployMethod',
11 # < mst> should be
12 # < mst> does => <some role>
13 # < mst> and that role should supply those methods
14 # < mst> then you can pass handles => <some role> as well
15
16   isa => 'DBIx::Class::DeploymentHandler::SqltDeployMethod',
17   is  => 'ro',
18   lazy_build => 1,
19   handles => [qw{
20     deployment_statements
21     deploy
22          create_install_ddl
23          create_update_ddl
24          create_ddl_dir
25          upgrade_single_step
26   }],
27 );
28
29 sub _build_deploy_method {
30         my $self = shift;
31         my $args = {
32                 schema            => $self->schema,
33                 databases         => $self->databases,
34                 upgrade_directory => $self->upgrade_directory,
35                 sqltargs          => $self->sqltargs,
36                 do_backup         => $self->do_backup,
37         };
38         $args->{backup_directory} = $self->backup_directory
39                 if $self->has_backup_directory;
40         DBIx::Class::DeploymentHandler::SqltDeployMethod->new($args);
41 }
42
43 1;
44
45 __END__
46
47 vim: ts=2,sw=2,expandtab