rake db:migrate doesn't seem to work in production
Ruby on-RailsRuby on-Rails-3Ruby on-Rails Problem Overview
I have two instances of my app: one for development, one for production. My development database is called snip_development
and my production database is called snip
.
I've been doing migrations all along in my development environment and it's been going just fine. I recently created a production instance of my app but rake db:migrate
doesn't seem to have any effect. After I run rake db:migrate
and log into my database server, I can see that snip_development
has all the tables I expect it to but snip
doesn't have any tables at all.
I suspect the problem is that rake db:migrate
is running on snip_development
instead of snip
and that's why I'm not seeing anything happen.
How do I get my migrations to work on my production database?
Ruby on-Rails Solutions
Solution 1 - Ruby on-Rails
Sometimes I forget about Google. The answer is this:
rake db:migrate RAILS_ENV=production
Solution 2 - Ruby on-Rails
For me the answer above not works. I have to add bundle exec
to make it works.
bundle exec rails db:migrate RAILS_ENV=production