Module: ActiveRecord::Turntable::Migration::ShardDefinition
- Defined in:
- lib/active_record/turntable/migration.rb
Instance Method Summary collapse
Instance Method Details
#clusters(*cluster_names) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/active_record/turntable/migration.rb', line 18 def clusters(*cluster_names) config = ActiveRecord::Base.turntable_configuration (self.target_shards ||= []).concat( if cluster_names.first == :all config.clusters.map(&:shards).flatten else cluster_names.map do |cluster_name| config.cluster(cluster_name).shards end.flatten end ) end |
#shards(*connection_names) ⇒ Object
31 32 33 |
# File 'lib/active_record/turntable/migration.rb', line 31 def shards(*connection_names) (self.target_shards ||= []).concat connection_names end |