php - "Unknown database type json requested, Doctrine\DBAL\Platforms\MySQL57Platform may not support it."运行 php artisan migrate 命令时

标签 php laravel laravel-5

当我运行时:

php artisan migrate

并希望将字符串字段修改为文本字段,如下所示:
//the old field that i want to modify in migration file
$table->string('description')->nullable();

//and the new text field
$table->text('description')->change();

我收到以下错误:

Unknown database type json requested, Doctrine\DBAL\Platforms\MySQL57Platform may not support it.

最佳答案

试试这个解决方案可能对你有用,

public function __construct()
{
    DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('json', 'text');
}

有关此问题的进一步阅读,请查看 Issue #15772在 Laravel 仓库

关于php - "Unknown database type json requested, Doctrine\DBAL\Platforms\MySQL57Platform may not support it."运行 php artisan migrate 命令时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48256476/

相关文章:

php - SQL 'Like' 导致重复内容

json - Laravel 和 Json : return the name of the array

php - 使用 yajra 数据表作为服务器端数据表

php - Laravel 模式 - 作业与服务的使用

php - 添加到多个表时Mysql当前时间戳

php - 将转换为 json 字符串的对象发送到 php 脚本

php - 我想使用从 Laravel 中的另一个表生成的 id 从表中打印列的值

mysql - Laravel Eloquent 相当于 MYSQL IN

laravel - 如何使用验证器外观将验证错误发送到 Blade View ?错误: Serialization of 'Closure' is not allowed

php - Laravel 在点击路线时创建数据库输入?