laravel voyager 执行php artisan voyager:install报错:1071 Specified key was too long;

详细错误如下:

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `translations` add unique `translations_table_name_column_name_foreign_key_locale_unique`(`table_na

me`, `column_name`, `foreign_key`, `locale`))

将APPserviceProvider改成如下后还是报错:

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

后来发现需要修改database.php文件:

'engine' => 'InnoDB ROW_FORMAT=DYNAMIC',

改完就好了

发表回复

您的电子邮箱地址不会被公开。