use parent 'DBIx::Class::Schema';
use Carp::Clan qw/^DBIx::Class/;
-use MooseX::Types::Moose qw/Int HashRef ArrayRef Str Any Bool/;
-use DBIx::Class::Admin::Types qw/DBICConnectInfo/;
+use MooseX::Types::Moose qw/Int Str Any Bool/;
+use DBIx::Class::Admin::Types qw/DBICConnectInfo DBICHashRef/;
use MooseX::Types::JSON qw(JSON);
use MooseX::Types::Path::Class qw(Dir File);
use Try::Tiny;
-use JSON::Any;
+use JSON::Any qw(DWIW XS JSON);
use namespace::autoclean;
-
=head1 NAME
DBIx::Class::Admin - Administration object for schemas
=head1 SYNOPSIS
+ $ dbicadmin --help
+
+ $ dbicadmin --schema=MyApp::Schema \
+ --connect='["dbi:SQLite:my.db", "", ""]' \
+ --deploy
+
+ $ dbicadmin --schema=MyApp::Schema --class=Employee \
+ --connect='["dbi:SQLite:my.db", "", ""]' \
+ --op=update --set='{ "name": "New_Employee" }'
+
use DBIx::Class::Admin;
# ddl manipulation
# install a version for an unversioned schema
$admin->install("3.0");
+=head1 REQUIREMENTS
+
+The following CPAN modules are required to use C<dbicadmin> and this module:
+
+L<Moose>
+
+L<MooseX::Types>
+
+L<MooseX::Types::JSON>
+
+L<MooseX::Types::Path::Class>
+
+L<Try::Tiny>
+
+L<parent>
+
+L<JSON::Any>
+
+(L<JSON::DWIW> preferred for barekey support)
+
+L<namespace::autoclean>
+
+L<Getopt::Long::Descriptive>
+
+L<Text::CSV>
+
=head1 Attributes
=head2 schema_class
has 'schema_class' => (
is => 'ro',
isa => Str,
- coerce => 1,
);
has 'where' => (
is => 'rw',
- isa => HashRef,
+ isa => DBICHashRef,
coerce => 1,
);
has 'set' => (
is => 'rw',
- isa => HashRef,
+ isa => DBICHashRef,
coerce => 1,
);
has 'attrs' => (
is => 'rw',
- isa => HashRef,
+ isa => DBICHashRef,
coerce => 1,
);
has config => (
is => 'ro',
- isa => HashRef,
+ isa => DBICHashRef,
lazy_build => 1,
);
sub _build_config {
my ($self) = @_;
- try { require Config::Any } catch { $self->throw_exception( "Config::Any is required to parse the config file"); };
+
+ eval { require Config::Any }
+ or $self->throw_exception( "Config::Any is required to parse the config file");
my $cfg = Config::Any->load_files ( {files => [$self->config_file], use_ext =>1, flatten_to_hash=>1});
return $cfg;
}
-=head1 AUTHORS
+=head1 AUTHOR
See L<DBIx::Class/CONTRIBUTORS>.