use Carp::Clan '^DBIx::Class::DeploymentHandler';
use SQL::Translator;
+BEGIN {
+ use Moose::Util::TypeConstraints;
+ subtype 'DBIx::Class::DeploymentHandler::Databases'
+ => as 'ArrayRef[Str]';
+
+ coerce 'DBIx::Class::DeploymentHandler::Databases'
+ => from 'Str'
+ => via { [$_] };
+ no Moose::Util::TypeConstraints;
+}
+
has schema => (
isa => 'DBIx::Class::Schema',
is => 'ro',
);
has databases => (
- # make this coerce from Str
- isa => 'ArrayRef[Str]',
- is => 'ro',
+ coerce => 1,
+ isa => 'DBIx::Class::DeploymentHandler::Databases',
+ is => 'ro',
default => sub { [qw( MySQL SQLite PostgreSQL )] },
);
my $handler = DBIx::Class::DeploymentHandler->new({
upgrade_directory => $sql_dir,
schema => $s,
- databases => ['SQLite'],
+ databases => 'SQLite',
});
ok($handler, 'DBIx::Class::DeploymentHandler w/1.0 instantiates correctly');
my $handler = DBIx::Class::DeploymentHandler->new({
upgrade_directory => $sql_dir,
schema => $s,
- databases => ['SQLite'],
+ databases => 'SQLite',
});
ok($handler, 'DBIx::Class::DeploymentHandler w/2.0 instantiates correctly');
my $handler = DBIx::Class::DeploymentHandler->new({
upgrade_directory => $sql_dir,
schema => $s,
- databases => ['SQLite'],
+ databases => 'SQLite',
});
ok($handler, 'DBIx::Class::DeploymentHandler w/3.0 instantiates correctly');