use List::MoreUtils qw(uniq);
with qw(
+ SQL::Translator::Schema::Role::BuildArgs
SQL::Translator::Schema::Role::Extra
SQL::Translator::Schema::Role::Error
SQL::Translator::Schema::Role::Compare
my $args = $self->$orig(@_);
foreach my $arg (keys %{$args}) {
- delete $args->{$arg} if !defined($args->{$arg}) || (ref($args->{$arg}) eq "ARRAY" && !@{$args->{$arg}});
+ delete $args->{$arg} if ref($args->{$arg}) eq "ARRAY" && !@{$args->{$arg}};
}
if (exists $args->{fields}) {
$args->{field_names} = delete $args->{fields};
use SQL::Translator::Utils qw(parse_list_arg ex2err throw);
with qw(
+ SQL::Translator::Schema::Role::BuildArgs
SQL::Translator::Schema::Role::Extra
SQL::Translator::Schema::Role::Error
SQL::Translator::Schema::Role::Compare
table => $table,
);
-=cut
-
-around BUILDARGS => sub {
- my $orig = shift;
- my $self = shift;
- my $args = $self->$orig(@_);
-
- foreach my $arg (keys %{$args}) {
- delete $args->{$arg} unless defined($args->{$arg});
- }
- return $args;
-};
-
=head2 comments
Get or set the comments on a field. May be called several times to
use List::MoreUtils qw(uniq);
with qw(
+ SQL::Translator::Schema::Role::BuildArgs
SQL::Translator::Schema::Role::Extra
SQL::Translator::Schema::Role::Error
SQL::Translator::Schema::Role::Compare
use List::MoreUtils qw(uniq);
with qw(
+ SQL::Translator::Schema::Role::BuildArgs
SQL::Translator::Schema::Role::Extra
SQL::Translator::Schema::Role::Error
SQL::Translator::Schema::Role::Compare
--- /dev/null
+package SQL::Translator::Schema::Role::BuildArgs;
+use Moo::Role;
+
+around BUILDARGS => sub {
+ my $orig = shift;
+ my $self = shift;
+ my $args = $self->$orig(@_);
+
+ foreach my $arg (keys %{$args}) {
+ delete $args->{$arg} unless defined($args->{$arg});
+ }
+ return $args;
+};
+
+1;
use List::Util 'max';
with qw(
+ SQL::Translator::Schema::Role::BuildArgs
SQL::Translator::Schema::Role::Extra
SQL::Translator::Schema::Role::Error
SQL::Translator::Schema::Role::Compare
use List::MoreUtils qw(uniq);
with qw(
+ SQL::Translator::Schema::Role::BuildArgs
SQL::Translator::Schema::Role::Extra
SQL::Translator::Schema::Role::Error
SQL::Translator::Schema::Role::Compare
use List::MoreUtils qw(uniq);
with qw(
+ SQL::Translator::Schema::Role::BuildArgs
SQL::Translator::Schema::Role::Extra
SQL::Translator::Schema::Role::Error
SQL::Translator::Schema::Role::Compare