lib/lhm.rb in lhm-1.3.0 vs lib/lhm.rb in lhm-2.0.0
- old
+ new
@@ -24,10 +24,14 @@
# @param [Hash] options Optional options to alter the chunk / switch behavior
# @option options [Fixnum] :stride
# Size of a chunk (defaults to: 40,000)
# @option options [Fixnum] :throttle
# Time to wait between chunks in milliseconds (defaults to: 100)
+ # @option options [Fixnum] :start
+ # Primary Key position at which to start copying chunks
+ # @option options [Fixnum] :limit
+ # Primary Key position at which to stop copying chunks
# @option options [Boolean] :atomic_switch
# Use atomic switch to rename tables (defaults to: true)
# If using a version of mysql affected by atomic switch bug, LHM forces user
# to set this option (see SqlHelper#supports_atomic_switch?)
# @yield [Migrator] Yielded Migrator object records the changes
@@ -36,11 +40,10 @@
def self.change_table(table_name, options = {}, &block)
origin = Table.parse(table_name, connection)
invoker = Invoker.new(origin, connection)
block.call(invoker.migrator)
invoker.run(options)
-
true
end
def self.cleanup(run = false)
lhm_tables = connection.select_values("show tables").select do |name|
@@ -70,10 +73,10 @@
ActiveRecord::Base.connection
end
end
protected
+
def self.connection
Connection.new(adapter)
end
-
end