lib/lhm.rb in lhm-1.0.3 vs lib/lhm.rb in lhm-1.1.0
- old
+ new
@@ -19,24 +19,27 @@
module Lhm
# Alters a table with the changes described in the block
#
# @param [String, Symbol] table_name Name of the table
- # @param [Hash] chunk_options Optional options to alter the chunk behavior
- # @option chunk_options [Fixnum] :stride
+ # @param [Hash] options Optional options to alter the chunk / switch behavior
+ # @option options [Fixnum] :stride
# Size of a chunk (defaults to: 40,000)
- # @option chunk_options [Fixnum] :throttle
+ # @option options [Fixnum] :throttle
# Time to wait between chunks in milliseconds (defaults to: 100)
+ # @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
# @return [Boolean] Returns true if the migration finishes
# @raise [Error] Raises Lhm::Error in case of a error and aborts the migration
- def self.change_table(table_name, chunk_options = {}, &block)
+ def self.change_table(table_name, options = {}, &block)
connection = ActiveRecord::Base.connection
origin = Table.parse(table_name, connection)
invoker = Invoker.new(origin, connection)
block.call(invoker.migrator)
- invoker.run(chunk_options)
+ invoker.run(options)
true
end
end
-