6 use Module::Runtime 'use_module';
8 use Path::Class 'file';
10 my $getopt = Getopt::Long::Parser->new(
11 config => [qw/gnu_getopt bundling_override no_ignore_case/]
14 $getopt->getoptions($args, qw/
19 die "You need to specify one DDL output filename via --ddl-out\n"
20 if @{$args->{'ddl-out'}||[]} != 1;
22 die "You need to specify one DBIC schema class via --schema-class\n"
23 if @{$args->{'schema-class'}||[]} != 1;
26 my $schema = use_module( $args->{'schema-class'}[0] )->connect();
29 if ($args->{'ddl-out'}[0] eq '-') {
33 my $fn = file($args->{'ddl-out'}[0]);
35 open $ddl_fh, '>', $fn
36 or die "Unable to open $fn: $!\n";
38 binmode $ddl_fh; # avoid win32 \n crapfest
40 print $ddl_fh scalar $schema->deployment_statements(
45 producer_args => { no_transaction => 1 },
46 quote_identifiers => 1,