Rails 6.1 adds support for role switching and sharding in database | Saeloun Blog
12-Jan-2021 1400
Rails 6.1 adds the ability to switch a role or shard for an application with multiple databases. This means it is possible to switch connections for one database instead of all databases globally.To use this feature, we need to set the below config in our application.config.active_record.legacy_connection_handling = falseLet’s say we have two databases, primary and vehicles. And we have shards and replica configured for each of them in database.yml as below:.
Rails 6.1 adds support for role switching and sharding in database | Saeloun Blog #ruby #rubydeveloper #rubyonrails #Rails #support #switching #sharding #database #Saeloun #blog #database https://rubyonrails.ba/link/rails-6-1-adds-support-for-role-switching-and-sharding-in-database-saeloun-blog