rake db:migrate for production databases

After I updated one of my applications that I’ve been working on, I kept running into an internal server error. I looked at the logs and for some reason none of my SQL queries were working.

Looks like I ran “rake db:migrate” and migrated the development database…not the production one. I scratched my head trying to remember the command. Here it is!”

rake db:migrate RAILS_ENV=”production”

Tags: , ,

4 comments

  1. in my bash profile on my deployment servers, I write an alias like this
    alias rk=”RAILS_ENV=production rake”

    so that I can type
    rk db:migrate

    or any rake tasks i need. Do this for script console too if you need it. Saves me alot of headaches

  2. Thanks for that, that's saved me some undue finger stress :)

  3. tks johanttan I got crazy looking for this

  4. I ran into a similar problem, but I was trying to specify the production environment with the parameter –environment='production' like we do for mongrel/webrick…
    for rake the env. should specify using RAILS_ENV

Leave a comment