From: Arthur Axel 'fREW' Schmidt Date: Tue, 23 Feb 2010 05:32:45 +0000 (-0600) Subject: more interface cleanup, dont use optional deps while this is not in core X-Git-Tag: v0.001000_01~142 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ecc3b6befe6dc156d027e9f4bb8d89145d0c3dd4;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git more interface cleanup, dont use optional deps while this is not in core --- diff --git a/lib/DBIx/Class/DeploymentHandler.pm b/lib/DBIx/Class/DeploymentHandler.pm index 52fabeb..ffc4441 100644 --- a/lib/DBIx/Class/DeploymentHandler.pm +++ b/lib/DBIx/Class/DeploymentHandler.pm @@ -6,6 +6,7 @@ require DBIx::Class::Schema; # loaded for type constraint require DBIx::Class::Storage; # loaded for type constraint require DBIx::Class::ResultSet; # loaded for type constraint use Carp::Clan '^DBIx::Class::DeploymentHandler'; +use SQL::Translator; has schema => ( isa => 'DBIx::Class::Schema', @@ -69,6 +70,12 @@ has databases => ( default => sub { [qw( MySQL SQLite PostgreSQL )] }, ); +has sqltargs => ( + isa => 'HashRef', + is => 'ro', + default => sub { {} }, +); + method _build_version_rs { $self->schema->set_us_up_the_bomb; $self->schema->resultset('__VERSION') @@ -171,10 +178,11 @@ method upgrade_single_step($db_version, $target_version) { }); } -method create_ddl_dir($version, $preversion, $sqltargs) { - my $schema = $self->schema; +method create_ddl_dir($version, $preversion) { + my $schema = $self->schema; my $databases = $self->databases; - my $dir = $self->upgrade_directory; + my $dir = $self->upgrade_directory; + my $sqltargs = $self->sqltargs; unless( -d $dir ) { carp "Upgrade directory $dir does not exist, using ./\n"; $dir = "./"; @@ -190,10 +198,6 @@ method create_ddl_dir($version, $preversion, $sqltargs) { %{$sqltargs || {}} }; - unless (DBIx::Class::Optional::Dependencies->req_ok_for ('deploy')) { - $self->throw_exception("Can't create a ddl file without " . DBIx::Class::Optional::Dependencies->req_missing_for ('deploy') ); - } - my $sqlt = SQL::Translator->new( $sqltargs ); $sqlt->parser('SQL::Translator::Parser::DBIx::Class');