Sha256: d9a72738c11e436245e4abec11c3923636997202eda9cb02e8a0b2f56f7805aa
Contents?: true
Size: 819 Bytes
Versions: 22
Compression:
Stored size: 819 Bytes
Contents
module Lhm class ChunkFinder def initialize(migration, connection = nil, options = {}) @migration = migration @connection = connection @start = options[:start] || select_start_from_db @limit = options[:limit] || select_limit_from_db end attr_accessor :start, :limit def table_empty? start.nil? && limit.nil? end def validate if start > limit raise ArgumentError, "impossible chunk options (limit (#{limit.inspect} must be greater than start (#{start.inspect})" end end private def select_start_from_db @connection.select_value("select min(id) from `#{ @migration.origin_name }`") end def select_limit_from_db @connection.select_value("select max(id) from `#{ @migration.origin_name }`") end end end
Version data entries
22 entries across 22 versions & 1 rubygems