[Dbix-class] Proposal for hook into deploy()
Jon Schutz
jon+dbix at youramigo.com
Sat Feb 23 01:38:57 GMT 2008
It would be useful to be able to get a handle on the intermediate
SQL::Translator schema object created during the call to deploy(), e.g.
to add custom indices or set specific table attributes.
The guts of DBIx::Class::Storage::DBI::deploy() is implemented in
deployment_statements() and the bit relevant to deployment via
SQL::Translator looks like:
my $tr = SQL::Translator->new(%$sqltargs);
SQL::Translator::Parser::DBIx::Class::parse( $tr, $schema );
return "SQL::Translator::Producer::${type}"->can('produce')->($tr);
which could be changed to:
my $tr = SQL::Translator->new(%$sqltargs);
SQL::Translator::Parser::DBIx::Class::parse( $tr, $schema );
$sqlt_callback->($tr) if $sqlt_callback;
return "SQL::Translator::Producer::${type}"->can('produce')->($tr);
where sqlt_callback can be pulled from the existing SQL::Translator args
hash (%sqltargs) parameter; the 'sources' key in sqltargs is also a non-
standard arg so there's a precedent there.
Any comments or suggestions of a better way?
--
Jon
More information about the DBIx-Class
mailing list