class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.column "first_name", :string, :limit => 25
t.string "last_name", :limit => 50
t.string "email", :default => "", :null => false
t.string "password", :limit => 40
t.timestamps
end
end
def down
drop_table :users
end
end
我试图运行rake db:migration并且我正在
mysql> rake db:migration;
错误1064(42000):您的SQL语法有错误;检查与您的MySQL服务器版本相对应的手册,以获得正确的语法,以便在“rake db:migration&#39;附近使用”。在第1行
答案 0 :(得分:1)
t.string "email", :default => "" :null => false
您在string
的参数之间缺少逗号,例如
t.string "email", default: "", null: false
答案 1 :(得分:0)
您不应该从mysql控制台运行rake命令。
打开终端并从那里运行rake db:migrate
。如果您仍然遇到任何问题 - 请更新问题。