“请求了未知的数据库类型json,Doctrine \ DBAL \ Platforms \ MySQL57Platform可能不支持它."在运行php artisan migration命令时 [英] "Unknown database type json requested, Doctrine\DBAL\Platforms\MySQL57Platform may not support it." while running php artisan migrate command

查看:349
本文介绍了“请求了未知的数据库类型json,Doctrine \ DBAL \ Platforms \ MySQL57Platform可能不支持它."在运行php artisan migration命令时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我跑步时:

php artisan migrate

,并希望将字符串字段修改为这样的文本字段:

and want to modify a string field to a text field like this:

//the old field that i want to modify in migration file
$table->string('description')->nullable();

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

我收到以下错误:

请求了未知的数据库类型json,Doctrine \ DBAL \ Platforms \ MySQL57Platform可能不支持它.

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

推荐答案

尝试此解决方案可能对您有用,

try this solution may be this will work for you,

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

有关此问题的更多信息,请在laravel回购中查看问题#15772

For further reading about this issue check Issue #15772 at laravel repo

这篇关于“请求了未知的数据库类型json,Doctrine \ DBAL \ Platforms \ MySQL57Platform可能不支持它."在运行php artisan migration命令时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆