[DBIx-Class-Devel] [dbsrgits/sql-translator] Add index length option for MySQL (#68)

Andy Beverley notifications at github.com
Mon Jun 19 07:01:32 GMT 2023


@nrdvana - yes, no problem at all. I think this patch would give you the foundation to implement #154. It enables fields to be specified as hashrefs (with properties) rather than just a simple scalar name. This particular patch then adds only one property, which is ```prefix_length```, but all the hard work is done so you could probably add other properties (I have just pushed another commit now that should enable that to happen, so that MySQL will ignore the option if it's not ```prefix_length```).

In changelog style:

- Enable index lengths to be specified for each indexed field in MySQL

As an example:

```$sqlt_table->add_index(name => 'user_idx_value', fields => [ { name => 'value', prefix_length => 64 } ]);```

So you could add another property, e.g.

```$sqlt_table->add_index(name => 'user_idx_t', fields => [ { name => 't', opclass => 'gin_trgm_ops' } ]);```

Take a look at this for example code which you could add to the PostgreSQL producer: https://github.com/abeverley/sql-translator/blob/d064562a9ff1f0f227a6bcd0ec8c6242454d6d61/lib/SQL/Translator/Producer/MySQL.pm#L688

-- 
Reply to this email directly or view it on GitHub:
https://github.com/dbsrgits/sql-translator/pull/68#issuecomment-1596619839
You are receiving this because you are subscribed to this thread.

Message ID: <dbsrgits/sql-translator/pull/68/c1596619839 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20230619/b4626d99/attachment-0001.htm>


More information about the DBIx-Class-Devel mailing list