Ruby on Rails Thursday, March 28, 2019

Does Rails 6 support multiple databases with different database schemas?

Rails 6 introduced support for multiple databases with this PR https://github.com/rails/rails/pull/34052
From my understanding the API designed by DHH https://github.com/rails/rails/pull/33877#issuecomment-421226095 seem to suggest that `animals` and `machines` have different structures however when I create an app with the database config as described there, when migrating, the same database structure from `base` gets copied in animals_structure.sql and machines_structure.sql .

I want to know if it's possible to have 2 databases with different structure as below

base_schema.rb
ActiveRecord::Schema.define(version: 2019) do
  create_table "create_users" do |t|
    t.string "name"
  end
end

animals_schema.rb
ActiveRecord::Schema.define(version: 2019) do
  create_table "create_dogs" do |t|
    t.string "fur_color"
  end
end

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a788e34d-2959-4111-afa1-868f1ebd3f7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment