laravel-migrations-generator icon indicating copy to clipboard operation
laravel-migrations-generator copied to clipboard

Creating indexes with length

Open boryn opened this issue 1 year ago • 1 comments

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).

boryn avatar Aug 31 '22 17:08 boryn

Hi @boryn , thanks for the feature suggestion.

I will look into this issue, PR is always welcome!

kitloong avatar Sep 01 '22 13:09 kitloong

Released with tag v6.4.3

kitloong avatar Oct 09 '22 11:10 kitloong