我无法在laravel 5.6中将表迁移到数据库中

时间:2018-09-30 07:19:53

标签: database laravel-5 migration

在laravel 5.6中,当我尝试迁移表“ todos”时,显示此错误:

Run file image

这是表代码:

Table code image

1 个答案:

答案 0 :(得分:0)

为此编辑appServiceProvider

use Illuminate\Support\Facades\Schema;

public function boot()
{
    Schema::defaultStringLength(191);
}

这是因为Laravel将其默认的数据库字符集更改为utf8mb4(即支持表情符号)。

请参阅此处的Laravel文档中的外观(标题为:Index Lengths & MySQL / MariaDB)https://laravel.com/docs/master/migrations#creating-indexes

相关问题