module Switchman::ActiveRecord::Migrator
Public Instance Methods
generate_migrator_advisory_lock_id()
click to toggle source
significant change: hash shard name, not database name
# File lib/switchman/active_record/migration.rb, line 24 def generate_migrator_advisory_lock_id shard_name_hash = Zlib.crc32(Shard.current.name) ::ActiveRecord::Migrator::MIGRATOR_SALT * shard_name_hash end
with_advisory_lock_connection() { |connection| ... }
click to toggle source
significant change: strip out prefer_secondary from config
# File lib/switchman/active_record/migration.rb, line 30 def with_advisory_lock_connection pool = ::ActiveRecord::ConnectionAdapters::ConnectionHandler.new.establish_connection( ::ActiveRecord::Base.connection_db_config.configuration_hash.except(:prefer_secondary) ) pool.with_connection { |connection| yield(connection) } # rubocop:disable Style/ExplicitBlockArgument ensure pool&.disconnect! end