Ruby-on-rails – Migrations are pending; run ‘bin/rake db:migrate RAILS_ENV=development’ to resolve this issue [unable to proceed]

rubyruby-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.

I have ran the following,

[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

I then proceeded with the migration,

[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

and the results are the same.

Best Answer

You need to do

bundle exec rake test:prepare 

or

bundle exec rake db:test:prepare

and then

bundle exec rake db:migrate

before running the specs

Cheers

cited from : Why am I asked to run 'rake db:migrate RAILS_ENV=test'?

Related Topic