rake db:migrate for production databases

February 19, 2009

 
No Gravatar

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”
  • 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
  • GonZoo
    tks johanttan I got crazy looking for this
  • jhnsntmthy
    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
  • Thanks for that, that's saved me some undue finger stress :)
blog comments powered by Disqus