Sha256: b0c9cdd90e96974d2fbc41ce21df1ad36783656951c111c4471addd44b5eb441

Contents?: true

Size: 734 Bytes

Versions: 9

Compression:

Stored size: 734 Bytes

Contents

module ActiveRecord::Turntable
  class SeqShard < Shard
    private

    def create_connection_class
      klass = get_or_set_connection_class
      klass.remove_connection
      klass.establish_connection ActiveRecord::Base.connection_pool.spec.config[:seq][name].with_indifferent_access
      klass
    end
 
    def retrieve_connection_pool
      ActiveRecord::Base.turntable_connections[name] ||=
        begin
          config = ActiveRecord::Base.configurations[Rails.env]["seq"][name]
          raise ArgumentError, "Unknown database config: #{name}, have #{ActiveRecord::Base.configurations.inspect}" unless config
          ActiveRecord::ConnectionAdapters::ConnectionPool.new(spec_for(config))
        end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
activerecord-turntable-2.5.0 lib/active_record/turntable/seq_shard.rb
activerecord-turntable-2.4.0 lib/active_record/turntable/seq_shard.rb
activerecord-turntable-2.3.3 lib/active_record/turntable/seq_shard.rb
activerecord-turntable-2.3.2 lib/active_record/turntable/seq_shard.rb
activerecord-turntable-2.3.1 lib/active_record/turntable/seq_shard.rb
activerecord-turntable-2.3.0 lib/active_record/turntable/seq_shard.rb
activerecord-turntable-2.2.2 lib/active_record/turntable/seq_shard.rb
activerecord-turntable-2.2.1 lib/active_record/turntable/seq_shard.rb
activerecord-turntable-2.2.0 lib/active_record/turntable/seq_shard.rb