=head1 VERSION
-Version 1.001008
+Version 1.001010
=cut
-our $VERSION = '1.001008';
+our $VERSION = '1.001010';
=head1 NAME
_inherited_attributes => [qw/datetime_relative might_have rules belongs_to/],
debug => $params->{debug} || 0,
ignore_sql_errors => $params->{ignore_sql_errors},
- dumped_objects => {}
+ dumped_objects => {},
+ use_create => $params->{use_create} || 0
};
bless $self, $class;
}
}
+ if($params->{excludes} && !$params->{all}) {
+ return DBIx::Class::Exception->throw("'excludes' param only works when using the 'all' param");
+ }
+
my $schema = $params->{schema};
my $config;
if ($params->{config}) {
my $config_file = $self->config_dir->file($params->{config});
$config = $self->load_config_file($config_file);
} elsif ($params->{all}) {
+ my %excludes = map {$_=>1} @{$params->{excludes}||[]};
$config = {
might_have => { fetch => 0 },
has_many => { fetch => 0 },
belongs_to => { fetch => 0 },
- sets => [map {{ class => $_, quantity => 'all' }} $schema->sources]
+ sets => [
+ map {
+ { class => $_, quantity => 'all' };
+ } grep {
+ !$excludes{$_}
+ } $schema->sources],
};
} else {
DBIx::Class::Exception->throw('must pass config or set all');
# optional, set to 1 to run ddl but not populate
no_populate => 0,
+ # optional, set to 1 to run each fixture through ->create rather than have
+ # each $rs populated using $rs->populate. Useful if you have overridden new() logic
+ # that effects the value of column(s).
+ use_create => 0,
+
# Dont try to clean the database, just populate over whats there. Requires
# schema option. Use this if you want to handle removing old data yourself
# no_deploy => 1
my $HASH1;
eval($contents);
$HASH1 = $fixup_visitor->visit($HASH1) if $fixup_visitor;
- push(@rows, $HASH1);
+ if ( $params->{use_create} ) {
+ $rs->create( $HASH1 );
+ } else {
+ push(@rows, $HASH1);
+ }
}
$rs->populate(\@rows) if scalar(@rows);
}