无法为在Elastic Beanstalk上运行的我的Rails应用程序设置AWS RDS。我跟着the docs,但是当它尝试运行迁移时,我得到MySQL语法错误。很确定我没有语法错误,因为迁移在本地运行良好,并且我成功设置了登台并且错误在第一行。我想这可能与安全组交通闭塞的事,但我适当地更新我的入站规则,并仍然得到错误:AWS EB上的Rails应用程序:迁移失败
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
我已为DB设置我的环境变量。我错过了什么?
我得到的错误:发生在第一次迁移
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 TABLEcoupons
(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:inchange' /opt/rubies/ruby-2.3.4/bin/bundle:22:in
load' /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 TABLE
coupons(
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:in
change' /opt/rubies/ruby-2.3.4/bin/bundle:22:inload' /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? sg-3221b354是您的RDS实例或EB实例的sec组? – strongjz
你有什么错误? – Brian
@Brian更新错误 – BooBailey