rake migrate for production environment

So, I’m happily developing away on my test machine. I make some changes. I commit them to my subversion repository. Having not set up a post-commit hook, I head to the webserver and update the local copy and I’ve got my changes. I made a database change, so I run rake migrate and restart the webserver.

It’s not working. I’m getting a Rails Application Error, instead of the stack trace.

Slight panic sets in. I reset the webserver again. Same problem. The generic error message doesn’t tell me what’s going wrong, so I dig in and investigate.

My production.log file and a quick glance at the database confirm that my production database wasn’t changed by the migration, even though the migration didn’t complain at me.

The default migrate environment is development. I know I can set the environment variable so the default is different, but I would rather err on the side of having to specify that I want something to run in production. I did go ahead and put rake migrate RAILS_ENV="production" in my deployment batch file so it reminds me.

2 Comments »

  1. Gabriel Birke Said,

    August 15, 2006 @ 12:02 pm

    I’m sure you meant “The default migrate environment is ‘development’” in your last paragraph :-)

    Apart from that: nice tip!

  2. Wes Said,

    August 15, 2006 @ 10:23 pm

    D’oh.
    *edits to fix*
    Thanks, Gabriel.

RSS feed for comments on this post · TrackBack URI

Leave a Comment

Comments are moderated.