Sha256: 910388420c006a73fd8b0df9e2ec54fb991f5227050e1b77d19fbc0d7c8ce426

Contents?: true

Size: 525 Bytes

Versions: 5

Compression:

Stored size: 525 Bytes

Contents

module Switchman
  module ActiveRecord
    module Migration
      def connection
        conn = super
        if conn.shard != ::ActiveRecord::Base.connection_pool.current_pool.shard
          ::ActiveRecord::Base.connection_pool.current_pool.switch_database(conn)
        end
        conn
      end
    end

    module Migrator
      def generate_migrator_advisory_lock_id
        shard_name_hash = Zlib.crc32(Shard.current.name)
        ::ActiveRecord::Migrator::MIGRATOR_SALT * shard_name_hash
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
switchman-1.9.14 lib/switchman/active_record/migration.rb
switchman-1.9.13 lib/switchman/active_record/migration.rb
switchman-1.9.12 lib/switchman/active_record/migration.rb
switchman-1.9.11 lib/switchman/active_record/migration.rb
switchman-1.9.10 lib/switchman/active_record/migration.rb