gpt4 book ai didi

mysql - 如何使用 Rails 5 迁移在 MySQL 中添加 JSON 列

转载 作者:可可西里 更新时间:2023-11-01 06:37:06 26 4
gpt4 key购买 nike

我试图通过运行在 MySQL 数据库中添加一个 json 列:

class AddStatisticsToPlayerStatistic < ActiveRecord::Migration[5.0]
def change
add_column :player_statistics, :statistics, :json
end
end

但是当我尝试运行 rake db:migrate 时出现了这个错误

Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'json' at line 1: ALTER TABLE `player_statistics` ADD `statistics` json

有谁知道如何在 MySQL Ver 14.14 Distrib 5.5.53 中添加 JSON 列。合适吗?

提前致谢!

最佳答案

MySQL 文档说 JSON native 数据类型从 5.7.8 开始 - json

关于mysql - 如何使用 Rails 5 迁移在 MySQL 中添加 JSON 列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41313166/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com