rake db:migrate 在我的开发服务器上失败,错误是:
Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for
at line 1: {:username=>"user", :password=>"user"}D:/WorkSpace/Ruby_WorkSPace/SLA_Rails_june10/db/migrate/20130611053608
d:in `migrate'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
我的迁移代码是:
class User < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.column :username , :string
t.column :password , :string
end
User.create :username=>"user" ,:password=>"user"
User.create :username=>"admin" ,:password=>"admin"
end
def self.down
drop_table :users
end
end
enter code here
我的型号代码是
class User < ActiveRecord::Base
attr_accessible :username, :password
end