class CreateUsers < ActiveRecord::Migration
def self.up
create_table "users", :force => true do |t|
t.column :login, :string
t.column :email, :string
t.column :crypted_password, :string, :limit => 40
t.column :salt, :string, :limit => 40
t.column :created_at, :datetime
t.column :updated_at, :datetime
t.column :remember_token, :string
t.column :remember_token_expires_at, :datetime
t.column :activation_code, :string
t.column :activated_at, :datetime
end
end
def self.down
drop_table "users"
end
end
运行rake db:migrate 产生如下提示:
rake aborted!
Mysql::Error: #HY000The 'InnoDB' feature is disabled; you need MySQL built with 'InnoDB' to have it working: CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB
(See full trace by running task with --trace)
解决方法:
1、找到mysql安装目录下的my.ini文件,查找到skip-innodb
2、在skip-innodb加上#
3、保存后重启mysql服务
4、重新运行rake db:migrate 成功。如下所示:
>rake db:migrate
(in D:/Aptana Studio/monkey)
== 20090209071007 CreateUsers: migrating ======================================
-- create_table("users", {:force=>true})
-> 0.0840s
== 20090209071007 CreateUsers: migrated (0.0840s) =============================