Support › MB Custom Table › Covering indexes
I would like to add some SQL indexes to MetaBox custom tables, what is the best way to achieve that?
When you create a table, you can set which column(s) are indexed. Just put the columns you want to index in the last param of MB_Custom_Table_API::create function.
For example, this code will index the column email:
MB_Custom_Table_API::create( 'my_custom_table', array(
'address' => 'TEXT NOT NULL',
'phone' => 'TEXT NOT NULL',
'email' => 'VARCHAR(20) NOT NULL',
), array( 'email' ) );
See the docs for more info.
If you want to do that manually with raw SQL, you can do that via a tool like phpMyAdmin.
The MetaBox API won't work for my needs, see example:
I'll add the index manually.