Monday, February 27, 2017

Rename an index in Laravel 5

I want to rename an index in Laravel 5.

In a previous migration a column was created for table named a like so:

$table->unsignedInteger('foo')->index('blah');

I want to rename the index so that it uses the default Laravel notation.

i.e. I want to rename the blah index to a_blah.

I know how to rename a normal column, like so:

$table->renameColumn('from', 'to');

But the documentation does not mention how to rename indexes.

How can I do this?

UPDATE

It seems that Laravel does not support this natively. Please upvote the issue:

http://ift.tt/2lPAder




via Yahya Uddin

Advertisement