Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple databases in migrations #830

Closed
lighthouse-import opened this issue May 16, 2011 · 1 comment
Closed

Support multiple databases in migrations #830

lighthouse-import opened this issue May 16, 2011 · 1 comment

Comments

@lighthouse-import
Copy link

Imported from Lighthouse. Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/6391
Created by Arthur Pirogovski - 2011-02-08 22:28:53 UTC

ActiveRecord natively supports multiple database connections. There's no reason for migrations not to do the same.

Not to mess things up, migrations for default database should still reside in db/migrate, while others should reside in db/migrate/database_config_name_without_environment_name.

Also, db:migrate should support option for specifying which database to run migrations on.

Directory layout example:

db/migrate
db/migrate/second

Corresponding db config:

### config/database.yml
development:
  adapter: sqlite3
  database: main_development

test:
  adapter: sqlite3
  database: main_test

production:
  adapter: sqlite3
  database: main_production

second_development:
  adapter: postgresql
  database: second_development

second_test:
  adapter: postgresql
  database: second_test

second_production:
  adapter: postgresql
  database: second_production
``` yaml
@damncabbage
Copy link

Why was this closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants