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',
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')
});
}
-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 = "./";
%{$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');