The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Rails: Running migrations in another environment

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Jay Fields

Posts: 765
Nickname: jayfields
Registered: Sep, 2006

Jay Fields is a software developer for ThoughtWorks
Rails: Running migrations in another environment Posted: Dec 14, 2006 2:56 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Jay Fields.
Original Post: Rails: Running migrations in another environment
Feed Title: Jay Fields Thoughts
Feed URL: http://blog.jayfields.com/rss.xml
Feed Description: Thoughts on Software Development
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Jay Fields
Latest Posts From Jay Fields Thoughts

Advertisement
From the command line it's possible to run migrations in any environment. For example, using the code below it is possible to run migrations in the test environment.
rake db:migrate RAILS_ENV=test
Because the above code works it would appear that you could create the following rake task to automate running the migrations in the test environment.
task :test_migrate do
ENV["RAILS_ENV"] = "test"
Rake::Task["db:migrate"].invoke
end
Unfortunately, that didn't work, but the following change does work.
task :test_migrate do
ActiveRecord::Base.establish_connection "test"
Rake::Task["db:migrate"].invoke
end

Read: Rails: Running migrations in another environment

Topic: Metaprogramming with Ruby Previous Topic   Next Topic Topic: Visual Database Explorer in Ruby

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use