4

Add `ActiveRecord::Base.prohibit_shard_swapping` by seejohnrun · Pull Request #4...

 2 years ago
source link: https://github.com/rails/rails/pull/43485
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Member

seejohnrun commented on Oct 18

Summary

When using sharded databases for the lifecycle of an entire request,
it's often desirable to ensure that the databases shard is not
unintentionally changed.

This commit introduces ActiveRecord::Base.prohibit_shard_swapping
which takes a block and prevents swapping of shards for its duration.

cc / @eileencodes


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK