Can rake db: create create tables in multiple databases?

Is it possible to create tables in two databases using db:create ? For example, can I have entries in database.yml for one_development and two_development , and both of them are created using rake db:create ? I know rake db: create: everything works - I'm just wondering if there is a way to segment what is created depending on RAILS_ENV?

+4
source share
3 answers

For one_development, you can run the following command:

 RAILS_ENV=one_development rake db:create 

For two_development, you can run the following command:

 RAILS_ENV=two_development rake db:create 
+6
source

Override the rake task or create a new one that runs rake db:create for the two required environments.

+1
source

It seems that all data sets are automatic. See Source:

http://dev.rubyonrails.org/changeset/6849

It doesn't seem to use RAILS_ENV as drop, etc.

0
source

All Articles