[Dbix-class] Proposal for hook into deploy()

Ash Berlin ash_cpan at firemirror.com
Sat Feb 23 11:47:26 GMT 2008


On 23 Feb 2008, at 01:38, Jon Schutz wrote:

> 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
>


Yes, how about this:

http://search.cpan.org/~jrobinson/DBIx-Class-0.08009/lib/DBIx/Class/Schema.pm#sqlt_deploy_hook($sqlt_schema)



More information about the DBIx-Class mailing list