in this tuto, I will show you how to manually configure the default string length generated by migrations in order for MySQL to create indexes for them.
You may configure this by calling the Schema::defaultStringLength
method within your AppServiceProvider
:
Example
<?php
namespace App\Providers;
use Illuminate\Database\Schema\Builder;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Builder::defaultStringLength(191);
}
}