Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rake db:migrate doesn't work (Rails 4.0.4)

I have a new app on Rails 4.0.4 / Ruby 2.1.0. The first thing I did was adding Devise gem. When I want to run rake db:migrate, it just does nothing. No error, but the migration isn't executed.

Could you please help me what to do with this case? I can't find where is the problem.

Thank You! Petr

like image 468
Petr Šuška Avatar asked Mar 22 '14 19:03

Petr Šuška


2 Answers

OK, so the problem was that Devise generator generated ".txt" file with migration instead of ".rb" file. Strange, but changing extension solved it.

like image 79
Petr Šuška Avatar answered Oct 15 '22 11:10

Petr Šuška


I had the same problem as you Petr and I think I found out why. For some reason when I ran 'rails g devise User', it created a migration (db/migrate/[timestamp]_devise_create_users.rb). That's what it suppose to be, but upon further examination, the migration was missing the '.rb' at the end. So it looked like (db/migrate/[timestamp]_devise_create_users). When I added the .rb at the end, and ran 'rake db:migrate' it worked like a charm. I don't know why rails didn't attach the '.rb' at the end. Hope that helps.

like image 7
Echen Avatar answered Oct 15 '22 11:10

Echen