From: Dagfinn Ilmari Mannsåker Date: Thu, 26 Jan 2017 18:28:05 +0000 (+0000) Subject: Only output trigger 'scope' if it's set in YAML and JSON producers X-Git-Tag: v0.11022~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4384692aca82fb49ad4a49c08d7ddbde85bc4ecb;p=dbsrgits%2FSQL-Translator.git Only output trigger 'scope' if it's set in YAML and JSON producers --- diff --git a/lib/SQL/Translator/Producer/JSON.pm b/lib/SQL/Translator/Producer/JSON.pm index d057d8e..b2f9004 100644 --- a/lib/SQL/Translator/Producer/JSON.pm +++ b/lib/SQL/Translator/Producer/JSON.pm @@ -149,7 +149,9 @@ sub view_trigger { 'fields' => scalar $trigger->fields, 'on_table' => scalar $trigger->on_table, 'action' => scalar $trigger->action, - 'scope' => scalar $trigger->scope, + (defined $trigger->scope ? ( + 'scope' => scalar $trigger->scope, + ) : ()), keys %{$trigger->extra} ? ('extra' => { $trigger->extra } ) : (), }; } diff --git a/lib/SQL/Translator/Producer/YAML.pm b/lib/SQL/Translator/Producer/YAML.pm index c5055ff..e7a8dc1 100644 --- a/lib/SQL/Translator/Producer/YAML.pm +++ b/lib/SQL/Translator/Producer/YAML.pm @@ -148,7 +148,9 @@ sub view_trigger { 'fields' => scalar $trigger->fields, 'on_table' => scalar $trigger->on_table, 'action' => scalar $trigger->action, - 'scope' => scalar $trigger->scope, + (defined $trigger->scope ? ( + 'scope' => scalar $trigger->scope, + ) : ()), keys %{$trigger->extra} ? ('extra' => { $trigger->extra } ) : (), }; }