Rake 无法迁移 [英] Rake not able to migrate

查看:53
本文介绍了Rake 无法迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C:\Users\MEGHA\bbbb>rake db:migrate
rake aborted!
SyntaxError: C:/Users/MEGHA/bbbb/db/migrate/20140402130040_create_comments.rb:4: syntax error, unexpected tIDENTIFIER, expecting keyword_end
C:65535:in `disable_ddl_transaction'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

20140402130040_create_comments.rb

20140402130040_create_comments.rb

class CreateComments < ActiveRecord::Migration
  def change
    create_table :comments do |t|
      t.string :post_id=integer
      t.text :body

      t.timestamps
    end
  end
end

推荐答案

改为:

class CreateComments < ActiveRecord::Migration
  def change
    create_table :comments do |t|
      t.string :post_id=integer #<= this 
      t.text :body

      t.timestamps
    end
  end
end

使用

class CreateComments < ActiveRecord::Migration
  def change
    create_table :comments do |t|
      t.integer :post_id
      t.text :body

      t.timestamps
    end
  end
end

这篇关于Rake 无法迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆