In my rails application I have two databases, I was able to get this up and running with following settings
database.yml
development: &defaults
adapter: mysql
encoding: utf8
database: <Database1>
username: <user_name>
password: <password>
host: localhost
second_development: &defaults
adapter: mysql
encoding: utf8
database: <Database2>
username: <user_name>
password: <password>
host: localhost
test: &defaults
adapter: mysql
encoding: utf8
database: <Database1_test>
username: <user_name>
password: <password>
host: localhost
second_test: &defaults
adapter: mysql
encoding: utf8
database: <Database2_test>
username: <user_name>
password: <password>
host: localhost
But the problem is when running the test cases, I'm using 'mocha', 'guard' and 'notahat-machinist', and when I try to run the test cases, it first runs the schema.rb file. But the problem is it creates the schema from the first test database only
test: &defaults
adapter: mysql
encoding: utf8
database: <Database1_test>
username: <user_name>
password: <password>
host: localhost
this will makes the test related to the second test database 'Database2_test' fail. What would be the workaround for this.
to generate a schema.rb file which has both the database schema.
thanks in advance
The schema.rb generate is define by the connection. So you need use the good connection in your test to have the good schema.