【问题标题】:I can't migrate table into database in laravel 5.6我无法在 laravel 5.6 中将表迁移到数据库中
【发布时间】:2019-03-05 15:32:07
【问题描述】:

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

这是表格代码:

Table code image

【问题讨论】:

标签: database laravel-5 migration


【解决方案1】:

appServiceProvider 编辑为:

use Illuminate\Support\Facades\Schema;

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

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

在此处查看 Laravel 文档中的 soutiuon(标题下方:Index Lengths & MySQL / MariaDB):https://laravel.com/docs/master/migrations#creating-indexes

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-02
    • 2019-06-09
    • 1970-01-01
    • 2019-04-25
    • 1970-01-01
    • 2018-08-22
    • 2019-01-26
    • 1970-01-01
    相关资源
    最近更新 更多