Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 36 lines (28 sloc) 962 Bytes
#!/usr/bin/env perl
use FindBin;
#use Devel::SimpleTrace;
use lib "$FindBin::Bin/../lib";
local $ENV{PDD_ENVIRONMENT} //= 'test';
local $ENV{DBIC_TRACE} //= 1;
use Pdd::Config;
use Pdd::Schema;
use DBIx::Class::Migration::Script;
use Pdd::Getopt;
my $opt = Pdd::Getopt->getopt(@ARGV);
my $cfg = Pdd::Config->config($opt->environment);
my $schema = Pdd::Schema->connect( $cfg->{db} );
my $guard = $schema->storage->txn_scope_guard;
local @ARGV = @{ $opt->extra_argv };
DBIx::Class::Migration::Script->run_with_options(
schema => $schema,
dbic_connect_attrs => {
on_connect_do => $cfg->{db}{on_connect_do},
quote_names => 1,
},
dsn => $cfg->{db}{dsn},
dh_args => { sql_translator_args => { quote_identifiers => 1, }, },
schema_class => "Pdd::Schema",
sandbox_class => 'PostgresqlSandbox',
extra_schemaloader_args => { db_schema => $cfg->{db}{db_schema} }
);
$guard->commit if $opt->commit;