use DBIx::Class::Admin::Descriptive;
#use Getopt::Long::Descriptive;
use DBIx::Class::Admin;
+require lib;
my $short_description = "utility for administrating DBIx::Class schemata";
-my $synopsis_text =qq{
+my $synopsis_text =q|
deploy a schema to a database
%c --schema=MyApp::Schema \
--connect='["dbi:SQLite:my.db", "", ""]' \
%c --schema=MyApp::Schema --class=Employee \
--connect='["dbi:SQLite:my.db", "", ""]' \
--op=update --set='{ "name": "New_Employee" }'
-}
-;
+|;
my ($opts, $usage) = describe_options(
"%c: %o",
['deploy' => 'Deploy the schema to the database',],
['select' => 'Select data from the schema', ],
['insert' => 'Insert data into the schema', ],
- ['update' => 'Update data in the schema', ],
+ ['update' => 'Update data in the schema', ],
['delete' => 'Delete data from the schema',],
['op:s' => 'compatiblity option all of the above can be suppied as --op=<action>'],
['help' => 'display this help', { implies => { schema_class => '__dummy__' } } ],
['force' => 'Be forceful with some operations'],
['trace' => 'Turn on DBIx::Class trace output'],
['quiet' => 'Be less verbose'],
+ ['I:s@' => 'Same as perl\'s -I, prepended to current @INC'],
)
);
die "please only use one of --config or --connect-info\n" if ($opts->{config} and $opts->{connect_info});
if($opts->{selfinject_pod}) {
+
+ die "This is an internal method, do not call!!!\n"
+ unless $ENV{MAKELEVEL};
+
$usage->synopsis($synopsis_text);
$usage->short_description($short_description);
exec (
);
}
+# FIXME - lowercasing will eventually go away when Getopt::Long::Descriptive is fixed
+if($opts->{i}) {
+ lib->import(delete $opts->{i});
+}
+
if($opts->{help}) {
$usage->die();
}
if($opts->{connect}) {
$opts->{connect_info} = delete $opts->{connect};
}
-
my $admin = DBIx::Class::Admin->new( %$opts );
-
my $action = $opts->{action};
$action = $opts->{op} if ($action eq 'op');
-print "Performig action $action...\n";
+print "Performing action $action...\n";
my $res = $admin->$action();
if ($action eq 'select') {