[Dbix-class] Creating functional indexes

Toby Corkindale toby at dryft.net
Mon Dec 13 05:55:08 GMT 2010


Hi,
I'd like to create functional indexes on some columns..
ie. The raw sql would be:
CREATE TABLE foo (bar TEXT);
CREATE INDEX foo_bar_idx ON foo( lower(bar) );

I'm trying to set this up via a DBIC Schema using sqlt_deploy_hook().

Is there a way?
I've tried
$sqlt_table->add_index(
  fields => ['lower(bar)']
);

and


$sqlt_table->add_index(
  fields => { lower => 'bar' }
);


but neither worked, and I can't see much that looks like it'll work in:
http://search.cpan.org/~jrobinson/SQL-Translator-0.11007/lib/SQL/Translator/Schema/Index.pm

Any suggestions?

Thanks,
Toby



More information about the DBIx-Class mailing list