Rails AWS EB 上的应用程序:迁移失败

Rails App on AWS EB: Migrations fail

在 Elastic Beanstalk 上为我的 Rails 应用 运行ning 设置 AWS RDS 时遇到问题。我遵循 the docs,但是当它尝试 运行 迁移时,我得到 MySQL 语法错误。很确定我没有语法错误,因为迁移 运行 在本地很好,我成功地设置了一个暂存并且错误在第一行。我想这可能与安全组阻止流量有关,但我适当地更新了我的入站规则,但仍然出现错误:

3306    tcp 173.8.166.54/32, sg-3221b354     <- RDs Security Group
80      tcp 0.0.0.0/0, ::/0, sg-3b31a75d        
22      tcp 0.0.0.0/0       
443     tcp 0.0.0.0/0       

我为数据库设置了环境变量。我错过了什么?

我遇到的错误:发生在第一次迁移的第一行

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, image varchar(255), code varchar(255), created_at datetime NOT NULL,' at line 1: CREATE TABLE coupons (id int AUTO_INCREMENT PRIMARY KEY, product varchar(255), offer varchar(255), size varchar(255), description varchar(255), info json, image varchar(255), code varchar(255), created_at datetime NOT NULL, updated_at datetime NOT NULL) ENGINE=InnoDB /var/app/ondeck/db/migrate/20170725193230_create_coupons.rb:3:in change' /opt/rubies/ruby-2.3.4/bin/bundle:22:inload' /opt/rubies/ruby-2.3.4/bin/bundle:22:in <main>' ActiveRecord::StatementInvalid: 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,imagevarchar(255),codevarchar(255),created_atdatetime NOT NULL,' at line 1: CREATE TABLEcoupons(idint AUTO_INCREMENT PRIMARY KEY,productvarchar(255),offervarchar(255),sizevarchar(255),descriptionvarchar(255),infojson,imagevarchar(255),codevarchar(255),created_atdatetime NOT NULL,updated_atdatetime NOT NULL) ENGINE=InnoDB /var/app/ondeck/db/migrate/20170725193230_create_coupons.rb:3:inchange' /opt/rubies/ruby-2.3.4/bin/bundle:22:in load' /opt/rubies/ruby-2.3.4/bin/bundle:22:in' 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, image varchar(255), code varchar(255), created_at datetime NOT NULL,' at line 1 /var/app/ondeck/db/migrate/20170725193230_create_coupons.rb:3:in `change'

有问题的迁移:

class CreateCoupons < ActiveRecord::Migration[5.0]
  def change
    create_table :coupons do |t|
      t.string :product
      t.string :offer
      t.string :size
      t.string :description
      t.json :info
      t.string :image
      t.string :code

      t.timestamps
    end
  end
end

原来rds上的mysql版本是错误的。 AWS 默认为 5.6。我升级到 5.7.17,一切正常。