Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=development' to resolve this issue [unable to proceed]

Tags:

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.

like image 452
user3010587 Avatar asked Nov 19 '13 21:11

user3010587


1 Answers

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'?

like image 146
igauravsehrawat Avatar answered Apr 05 '23 10:04

igauravsehrawat