Skip to main content
Category:

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

    }

}

Riadh Rahmi

Senior Web Developer PHP/Drupal & Laravel

I am a senior web developer, I have experience in planning and developing large scale dynamic web solutions especially in Drupal & Laravel.

Web Posts

Search

Page Facebook