blib/script/dbix-migration.pl untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 45 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/local/bin/perl -w
2  
3 use strict;
4 use Getopt::Long;
5 use Pod::Usage;
6 use DBIx::Migration;
7  
8 my $debug = 0;
9 my $help = 0;
10 my ( $username, $password );
11  
12 GetOptions(
13 'debug' => \$debug,
14 'help|?' => \$help,
15 'password=s' => \$password,
16 'username=s' => \$username
17 );
18 pod2usage(1) if ( $help || !$ARGV[0] );
19  
20 unless ( $ARGV[1] ) {
21 my $m = DBIx::Migration->new(
22 {
23 debug => $debug,
24 dsn => $ARGV[0],
25 password => $password,
26 username => $username
27 }
28 );
29 my $version = $m->version;
30 if ( defined $version ) { print "Database is at version $version\n" }
31 else { print "Database is not yet under DBIx::Migration management\n" }
32 exit;
33 }
34  
35 pod2usage(1) if !$ARGV[1];
36  
37 my $m = DBIx::Migration->new(
38 {
39 debug => $debug,
40 dsn => $ARGV[0],
41 dir => $ARGV[1],
42 password => $password,
43 username => $username
44 }
45 );
46 $m->migrate( $ARGV[2] );
47  
48 1;
49 __END__