Reputation: 3369
I have two folders with 2 differents apps rails. I want use mysql with both, so I use same database.yml configuration, but the second app do not create their own "db/development.mysql", and after "rake db:migrate", schema.rb include now migration of my first app and the second...
How can I use separate mysql db for my 2 apps?
thx.
Upvotes: 1
Views: 43
Reputation: 3347
Mysql is not installed locally to your project, but gloabally for your system.
So when you specify mysql2 as the database adapter, you should not expect to have anything like db/some_db.mysql
to exist.
In mysql you can have different databases, each one containing an arbitrary set of tables (table names can be the same between databases, i.e., you can have a users
table in each of them).
In your database.yml
you have to write a different database name for each project
In your first app:
development:
adapter: mysql2
encoding: utf8
username: your_user
password: your_password
database: first_app_dbname
encoding: utf8
in the second:
development:
adapter: mysql2
encoding: utf8
username: your_user
password: your_password
database: second_app_dbname
encoding: utf8
Upvotes: 2