From: Arthur Axel 'fREW' Schmidt Date: Fri, 3 Aug 2012 01:41:50 +0000 (-0500) Subject: Added helpful logging for the schema_from_schema_loader ScriptHelper X-Git-Tag: v0.002200~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=855a668c36f1545293453746060ef435291c2c54;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git Added helpful logging for the schema_from_schema_loader ScriptHelper --- diff --git a/Changes b/Changes index 0e836a3..f877f77 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ Revision history for {{$dist->name}} {{$NEXT}} + - Added helpful logging for the schema_from_schema_loader ScriptHelper - Added much more helpful error for "Can't find source for..." error in migration scripts, based on code from DBIx::Class::Migration - Test suite now is fully parallelizable diff --git a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator/ScriptHelpers.pm b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator/ScriptHelpers.pm index 77d52ac..622dc29 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator/ScriptHelpers.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator/ScriptHelpers.pm @@ -10,6 +10,7 @@ use Sub::Exporter::Progressive -setup => { use List::Util 'first'; use Text::Brew 'distance'; use Try::Tiny; +use DBIx::Class::DeploymentHandler::LogImporter qw(:dlog); sub dbh { my ($code) = @_; @@ -46,6 +47,9 @@ sub schema_from_schema_loader { if $opts->{naming} eq 'current' || (ref $opts->{naming} eq 'HASH' && first { $_ eq 'current' } values %{$opts->{naming}}); + $opts->{debug} = 1 + if !exists $opts->{debug} && $ENV{DBICDH_TRACE}; + sub { my ($schema, $versions) = @_; @@ -57,6 +61,10 @@ sub schema_from_schema_loader { my $new_schema = DBIx::Class::Schema::Loader::make_schema_at( 'SHSchema::' . $count++, $opts, \@ci ); + + Dlog_debug { + "schema_from_schema_loader generated the following sources: $_" + } [ $new_schema->sources ]; my $sl_schema = $new_schema->connect(@ci); try { $code->($sl_schema, $versions)