Rails 能在 rake db:migrate 的时候指定数据库名吗?

lb563 · March 25, 2012 · Last by lb563 replied at March 25, 2012 · 3783 hits

现在有两个数据库 A,B.我需要在 rake db:migrate 的时候指定另外一个数据库 B.有没有方法呢?

1 楼提供的那部分代码,看一下,自己改写个 migrate 出来,或者 load_config。、 看你怎么整了,你提供的信息太少了。

我找到一种方法来处理我的需求,给大家分享一下: http://pullmonkey.com/2008/4/21/ruby-on-rails-multiple-database-connections/

RAILS_ENV=another_db rake db:migrate

且在 database.yml 为 another_db 写入配置

#5 楼 @psvr 嗯,这个方法也行。能处理我的问题,多谢

You need to Sign in before reply, if you don't have an account, please Sign up first.