laravel-migrations-generator
laravel-migrations-generator copied to clipboard
Creating indexes with length
My table has index defined as:
INDEX `event_type_idx` (`event_type`(16)) USING BTREE
which means I want to use index of length of 16 for this field (event_type
is VARCHAR(1000)
)
unfortunately the library produces this code:
$table->index(['event_type'], 'event_type_idx');
it would be much better if it could produce:
$table->index([DB::raw('event_type(16)')], 'event_type_idx');
so to take info account the real index length. Now ignoring this information may lead to failure due to MySQL index length limits (especially in multiple column indexes).
Hi @boryn , thanks for the feature suggestion.
I will look into this issue, PR is always welcome!
Released with tag v6.4.3