2016-07-28 22:51 GMT+02:00 Cédric Krier <issue_tracker@tryton.org>:

Cédric Krier <cedric.krier@b2ck.com> added the comment:

I propose instead of overriding __register__ and use TableHandler to add the indexes, we could have an attribute on the ModelSQL to list the indexes '_sql_indexes' just like we have '_sql_constraint'.
The syntax could be:

_sql_indexes = [
    ['column1', 'column2'],

This misses the type of index which is important, and I guess it will be even more important in the future. The storage part of PostgreSQL is becoming more and more extensible and I think we can expect more index types to be added in the future.

Also, we should see how you'd manage more complex indexes. For example one can create an index on an expression, not only a field.

My feeling is that indexes should be something that is not part of the module and is more a DBA job.

If we feel we should help our users, we could create an automated tool that assists on that though I guess there is already something available.

Tryton issue tracker <issue_tracker@tryton.org>

Albert Cervera i Areny
Tel. 93 553 18 03