[Dbix-class] Add an 'excludes' option to DBIC::Fixtures->dump

John Napiorkowski jjn1056 at yahoo.com
Wed Feb 9 23:08:07 GMT 2011


The DBIC::Fixtures->dump({all=>1, ...}) option is really useful to just dump the 
entire db.  However, if you are using versioning tools, like 
DBIC::DeploymentHandler, this will pickup the generated tables to manage 
versioning (for example, DBIC::DeploymentHandler creates a table called 
'dbix_class_deploymenthandler_versions') which is something you probably don't 
want, if you are using DBIC::Fixtures with versioning.

I propose adding a new dump method options called 'exclude', which takes an 
arrayref of source names to skip when processing the 'all' option.  I've cut a 
branch and am proposing a patch similar to:

http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits/DBIx-Class-Fixtures.git;a=commitdiff;h=47a8ceb927de1d34efb41834e89dd6020a0d3191


I tested this on my personal application and found it to work.   Here's a 
sample:

my $fixtures = DBIx::Class::Fixtures->new({
  config_dir => Freestock::Web->path_to('share', 'db', 'fixture_configs'),
});

sub dump_fixtures {
  $fixtures->dump({
    all => 1,
    excludes => ['__VERSION'],
    schema => $schema,
    directory => $fixtures_dir,
  });
}

Thoughts?  Comments?  Thanks!

John Napiorkowski


 
____________________________________________________________________________________
The fish are biting. 
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php



More information about the DBIx-Class mailing list