set rake db:migrate environment

When running rake db:migrate, how do you control which environment gets migrated? Running it without options always updates the development database. This is obviously not what I want to do on the production server.

Thank you, Landon

RAILS_ENV=production rake db:migrate


Thank you!

So the next question is, where is that in the documentation?

Dunno, it's been a while since I had to look that one up :-). It works for almost everything. Rails looks to the RAILS_ENV env variable to set it's mode. You can do the same with:

  RAILS_ENV=production script/console

or a script/server, or a bunch of other little things.

RAILS_ENV=production rake db:migrate