如何使用Rails 5 Migration在MySQL中添加JSON列
我正在尝试通过运行在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本机数据类型从5.7.8开始 – json