Rails 6.1 adds support for role switching and sharding in database | Saeloun Blog

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 #rails #rubyonrails #bosnia #programming #tutorials #rubydeveloper #railsdeveloper

Nezir Zahirovic

Freelance software developer Ruby On Rails (6 years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles