'MooseX::Types::Path::Class' => '0.05',
'MooseX::Types::JSON' => '0.02',
'Try::Tiny' => '0.02',
- 'namespace::clean' => '0.11',
+ 'namespace::autoclean' => '0.09',
'parent' => '0.223',
'JSON::Any' => '0',
'Getopt::Long::Descriptive' => '0.081',
package DBIx::Class::Admin;
-use Moose;
-use MooseX::Types -declare => [qw( DBICConnectInfo )];
-use MooseX::Types::Moose qw/Int HashRef ArrayRef Str Any/;
-use MooseX::Types::JSON qw(JSON);
-use MooseX::Types::Path::Class qw(Dir File);
-use Try::Tiny;
+# check deps
+BEGIN {
+ my @_deps = qw(
+ Moose MooseX::Types MooseX::Types::JSON MooseX::Types::Path::Class
+ Try::Tiny parent JSON::Any Class::C3::Componentised
+ namespace::autoclean
+ );
+
+ my @_missing_deps;
+ foreach my $dep (@_deps) {
+ eval "require $dep";
+ if ($@) {
+ push @_missing_deps, $dep;
+ }
+ }
-use Carp::Clan qw/^DBIx::Class/;
+ if (@_missing_deps > 0) {
+ die "The following dependecies are missing " . join ",", @_missing_deps;
+ }
+}
-use parent 'Class::C3::Componentised';
+use Moose;
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::JSON qw(JSON);
+use MooseX::Types::Path::Class qw(Dir File);
+use Try::Tiny;
use JSON::Any;
-
use namespace::autoclean;
-my @_deps = qw(Moose MooseX::Types MooseX::Types::JSON MooseX::Types::Path::Class Try::Tiny parent JSON::Any Class::C3::Componentised namespace::autoclean);
-
-coerce ArrayRef,
- from JSON,
- via { _json_to_data ($_) };
-
-coerce HashRef,
- from JSON,
- via { _json_to_data($_) };
-
-subtype DBICConnectInfo,
- as ArrayRef;
-
-coerce DBICConnectInfo,
- from JSON,
- via { return _json_to_data($_) } ;
-
-coerce DBICConnectInfo,
- from Str,
- via { return _json_to_data($_) };
-
-coerce DBICConnectInfo,
- from HashRef,
- via { [ $_->{dsn}, $_->{user}, $_->{password} ] };
-
=head1 NAME
has 'schema_class' => (
is => 'ro',
- isa => 'Str',
+ isa => Str,
coerce => 1,
);
has 'config_stanza' => (
is => 'ro',
- isa => 'Str',
+ isa => Str,
);
has version => (
is => 'rw',
- isa => 'Str',
+ isa => Str,
);
has preversion => (
is => 'rw',
- isa => 'Str',
+ isa => Str,
);
has force => (
is => 'rw',
- isa => 'Bool',
+ isa => Bool,
);
has quiet => (
is => 'rw',
- isa => 'Bool',
+ isa => Bool,
);
has '_confirm' => (
is => 'bare',
- isa => 'Bool',
+ isa => Bool,
);
return $cfg;
}
-sub _json_to_data {
- my ($json_str) = @_;
- my $json = JSON::Any->new(allow_barekey => 1, allow_singlequote => 1, relaxed=>1);
- my $ret = $json->jsonToObj($json_str);
- return $ret;
-}
-
-
-{ # deps check
-
-my @_missing_deps;
-foreach my $dep (@_deps) {
- eval "require $dep";
- if ($@) {
- push @_missing_deps, $dep;
- }
-}
-
-if (@_missing_deps > 0) {
- die "The following dependecies are missing " . join ",", @_missing_deps;
-}
-
-
-}
-
-
=head1 AUTHORS
See L<DBIx::Class/CONTRIBUTORS>.
--- /dev/null
+package # hide from PAUSE
+ DBIx::Class::Admin::Types;
+
+use MooseX::Types -declare => [qw(
+ DBICConnectInfo
+)];
+use MooseX::Types::Moose qw/Int HashRef ArrayRef Str Any Bool/;
+use MooseX::Types::JSON qw(JSON);
+
+coerce ArrayRef,
+ from JSON,
+ via { _json_to_data ($_) };
+
+coerce HashRef,
+ from JSON,
+ via { _json_to_data($_) };
+
+subtype DBICConnectInfo,
+ as ArrayRef;
+
+coerce DBICConnectInfo,
+ from JSON,
+ via { return _json_to_data($_) } ;
+
+coerce DBICConnectInfo,
+ from Str,
+ via { return _json_to_data($_) };
+
+coerce DBICConnectInfo,
+ from HashRef,
+ via { [ $_ ] };
+
+sub _json_to_data {
+ my ($json_str) = @_;
+ my $json = JSON::Any->new(allow_barekey => 1, allow_singlequote => 1, relaxed=>1);
+ my $ret = $json->jsonToObj($json_str);
+ return $ret;
+}
+
+1;
['create|c' => 'Create version diffs needs preversion',],
['upgrade|u' => 'Upgrade the database to the current schema '],
['install|i' => 'Install the schema to the database',],
- ['deploy|d' => 'Deploy the a to the database',],
+ ['deploy|d' => 'Deploy the schema to the database',],
['select|s' => 'Select data from the schema', ],
['insert|i' => 'Insert data into the schema', ],
['update|u' => 'Update data in the schema', ],