Running rails migrations in other databases

We have a set of Ruby on Rails applications that shares user logins, so we put that table in a database and connect to it from each application. If an app needs to add a column to the shared table, you can create a migration that accesses that other database. First, create an entry in your database.yml file (we name ours "user_development", etc.). Then, establish that connection in your database migration and do your migration stuff: This has the benefit of keeping all the migrations local to the app they're needed for, but it stores the schema of the users table in the users database where it belongs.

Established 2005 · Databasically © 2016

sitemap