[Dbix-class] Table indexes for deployment
Eric Waters
ewaters at xmission.com
Tue Jun 19 20:51:23 GMT 2007
Let's get talking about being able to define table indexes in the DBIC schema in the same way the `extras' field is a passthru to SQL::Translator in the (experimental) Schema->deploy():
__PACKAGE__->add_columns(
id => { data_type => 'INT', is_auto_increment => 1, extras => { unsigned => 1 }, },
author => { data_type => 'INT', extras => { unsigned => 1 }, },
);
__PACKAGE__->add_indexes(
author_idx => { columns => [ 'author' ], options => [ ... ] },
);
When $schema->deploy(), causes SQL::Translator object to be called like:
$tr->schema->get_table('table_name')->add_index(
name => 'author_idx',
fields => [ 'author' ],
options => [ ... ],
);
foreach table index prior to the deployment of the schema to the storage. The options (and any other args) could be passthru to SQL::Translator::Schema::Table->add_index(), with the DBIC key 'columns' remapped to the SQLT key 'fields'.
Thoughts?
Eric Waters
More information about the Dbix-class
mailing list