This project is archived and is in readonly mode.

#6391 new
Arthur Pirogovski

Support multiple databases in migrations

Reported by Arthur Pirogovski | February 8th, 2011 @ 10:28 PM

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

No comments found

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages