stephenafamo/bob

How to access nonunique indexes for tables in code generation?

majiaxin110 opened this issue · 1 comments

I use this library extensively to generate an orm that is somewhat customized. I wonder if there is a way to access and output all the index names of a table when I write a custom template for code generation.

Accessing indexes masters especially when index hints must be provided. (https://dev.mysql.com/doc/refman/8.0/en/index-hints.html).

I find there are primary keys, foreign keys, and constraints in gen/drivers/Table. It seems nonunique indexes are missed.

For now, I may choose to implement a TemplateDataPlugin, which accesses all indexes and writes them to ExtraInfo in TemplateData. Is it a good practice? Or may I use such feature in the future?

Thanks a lot!

Up till now, retrieving index information was not a priority so it was not included.

It would of course be a welcome addition, so if you can send in a PR for this (even if just for MySQL), I would appreciate it.