Forum: Ruby on Rails set rake db:migrate environment

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B87bbdb1b142a6da99983ccae9fc33bc?d=identicon&s=25 Landon (Guest)
on 2007-06-06 19:36
(Received via mailing list)
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
39b36b2be47228f8619d61ea7a607a25?d=identicon&s=25 Matthew Beale (mixonic)
on 2007-06-06 19:41
(Received via mailing list)
On Wed, 2007-06-06 at 17:35 +0000, Landon wrote:
> 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.
>

RAILS_ENV=production rake db:migrate

Whammo.

--
Matthew Beale :: 607 227 0871
Resume & Portfolio @ http://madhatted.com
B87bbdb1b142a6da99983ccae9fc33bc?d=identicon&s=25 Landon (Guest)
on 2007-06-06 19:49
(Received via mailing list)
Thank you!

So the next question is, where is that in the documentation?
39b36b2be47228f8619d61ea7a607a25?d=identicon&s=25 Matthew Beale (mixonic)
on 2007-06-06 19:54
(Received via mailing list)
On Wed, 2007-06-06 at 17:48 +0000, Landon wrote:
> 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.

--
Matthew Beale :: 607 227 0871
Resume & Portfolio @ http://madhatted.com
588ab1c0a5610a7e160a3b101abb91e6?d=identicon&s=25 MichaelLatta (Guest)
on 2007-06-06 21:29
(Received via mailing list)
RAILS_ENV=production rake db:migrate

Michael
This topic is locked and can not be replied to.