Friday, April 29, 2011

multiple rails sites pointing to the same database

Hello,

I want to run two rails websites (homepage and app) on the same database. However, migrations dont work because both websites try to use schema_migrations table at the same time.

Is it possible to override default schema_migrations table name? Any other ideas how to solve this problem?

From stackoverflow
  • The schema_migrations table name is kept in ActiveRecord::Migrator.schema_migrations_table_name, which you might me able to override (in environment.rb, initializers, etc.), but I haven't tried this.

    On the other hand, if you use unique migration IDs in both application (default in 2.1 onwards, I think), migrations from two applications should work with a single schema_migrations table.

    See this screencast for more information on how migrations work in Rails 2.1 and up.

    Mantas : ActiveRecord::Migrator.schema_migrations_table_name seems to be frozen and rails doesnt allow t override it. Hmm, I'll try to have both apps to write into the same schema_migrations. Thanks for the answer anyway
  • Could you use Rails Engines for your different sites? Don't know if that would work for your situation, but it would eliminate this problem.

    http://rails-engines.org/news/2009/02/02/engines-in-rails-2-3

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.