SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length

Ad大成

关注

阅读 72

2023-03-10


AppServiceProvider boot方法下新增


Schema::defaultStringLength(191);

<?php

namespace App\Providers;

use Illuminate\Support\Facades\Schema;
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()
{
Schema::defaultStringLength(191);
}
}

精彩评论(0)

0 0 举报