Laravel Specific Key Was Too Long

记录一个小问题,本地用wampp是出现的,laravel使用migrate是出现的。

方法也很简单,搜了一下找到了解决方案。

namespace App\Providers;

use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
        Schema::defaultStringLength(191);
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

具体文件在app\providers 文件夹中

Last modification:October 23rd, 2017 at 02:45 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment