迁移待定;运行“bin/rake db:migrate RAILS_ENV=development"来解决这个问题[无法继续] [英] Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=development' to resolve this issue [unable to proceed]

查看:40
本文介绍了迁移待定;运行“bin/rake db:migrate RAILS_ENV=development"来解决这个问题[无法继续]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎有一个关于 Ruby on Rails 迁移过程的循环问题.我正在关注介绍文章,我已经到了需要创建第一个表的地步.

I appear to have a circular issue in regards to Ruby on Rails migration procedure. I am following the introduction article and I have reached the point when I need to create my first table.

我已经运行了以下,

[tims@web2 working_ror]# rails generate model Homepage first_name:string  last_name:string email:string message:text
  invoke  active_record
  create    db/migrate/20131119203948_create_homepages.rb
  create    app/models/homepage.rb
  invoke    test_unit
  createtest    /models/homepage_test.rb
  createtest    /fixtures/homepages.yml

然后我继续进行迁移,

[tims@web2 working_ror]# rake db:migrate
==  CreateHomepages: migrating ================================================
-- create_table(:homepages)
   -> 0.0493s
==  CreateHomepages: migrated (0.0494s) =======================================

但是,当我运行我的应用程序时,我看到以下消息,

, however, when I run my application I see the following message,

Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=development' to resolve this issue.

但是,如果我运行上面的代码,

but, IF I run the above,

[tims@web2 working_ror]# rake db:migrate RAILS_ENV=development
[tims@web2 working_ror]# 

消息还在继续......

and the message continues ...

我花了大量时间研究论坛——我能找到的最接近的方法是删除并重新构建所有内容,这些论坛做了以下工作.

I have spent considerable amount of time researching forums in-which the closest I could find was to drop and re-build everything, which have done the following.

耙分贝:下降耙数据库:创建耙数据库:迁移

rake db:drop rake db:create rake db:migrate

结果是一样的.

推荐答案

你需要做的

bundle exec rake test:prepare 

bundle exec rake db:test:prepare

然后

bundle exec rake db:migrate

在运行规范之前

干杯

引自:为什么我会被问到运行'rake db:migrate RAILS_ENV=test'?

这篇关于迁移待定;运行“bin/rake db:migrate RAILS_ENV=development"来解决这个问题[无法继续]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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