Permalink
Browse files

Implement _build_database_exists by trying to build a database handle

  • Loading branch information...
1 parent ee11ffb commit 9c69e28290aa1e756eb5fdae21035c2d61e11bab @autarch autarch committed Apr 1, 2013
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/Database/Migrator/Core.pm
@@ -15,7 +15,6 @@ use Moose::Role;
with 'MooseX::Getopt::Dashes';
requires qw(
- _build_database_exists
_create_database
_drop_database
_run_ddl
@@ -227,6 +226,13 @@ sub _build_logger {
return Log::Dispatch->new( outputs => [$outputs] );
}
+sub _build_database_exists {
+ my $self = shift;
+
+ local $@;
+ return eval { $self->_build_dbh() } ? 1 : 0;
+}
+
sub _build_dbh {
my $self = shift;

0 comments on commit 9c69e28

Please sign in to comment.