【问题标题】:Could not migrate JSON Datatype无法迁移 JSON 数据类型
【发布时间】:2020-06-21 18:10:10
【问题描述】:

当我尝试在迁移中使用 $table->json('custom_data')->nullable(); 时。它在运行php artisan migrate 命令时抛出以下错误:

PDOException::("SQLSTATE[42704]: Undefined object: 7 ERROR:  type "json" does not exist at character 236")

版本:

Laravel 6.2
PostgreSQL 9.1.1

PostgreSQL(libpq) Version 9.6

【问题讨论】:

  • 分享您的代码和示例数据
  • 如果您的 PostgreSQL 版本低于 9.4,请使用 jsonb 而不是 json $table->jsonb('custom_data')->nullable();

标签: laravel postgresql postgresql-9.1


【解决方案1】:

从 9.2 版本开始,PostgreSQL 支持 JSON 数据类型

gab.lc.

所以 PostgreSQL 9.1.1 不支持 json 数据类型

您必须升级 PostgreSQL 版本才能接受 json 列 见docs.bmc.com

【讨论】:

    猜你喜欢
    • 2021-09-08
    • 2017-05-13
    • 1970-01-01
    • 2016-11-21
    • 2014-08-07
    • 2019-07-14
    • 2012-11-16
    • 2020-09-18
    • 1970-01-01
    相关资源
    最近更新 更多