我似乎有一个关于 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
发布评论