rake db:migrate 迁移不成功的原因

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) =============================

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值