diff --git a/lib/lhm.rb b/lib/lhm.rb index 9232f2b4..575bd791 100644 --- a/lib/lhm.rb +++ b/lib/lhm.rb @@ -55,6 +55,7 @@ def sync_table(table_name, sync_table, options = {}, &block) origin = Table.parse(table_name, connection) invoker = Invoker.new(origin, connection) block.call(invoker.migrator) + options.merge!({disable_switcher: true}) invoker.run(options) ensure Lhm::Table.naming_strategy = nil diff --git a/lib/lhm/invoker.rb b/lib/lhm/invoker.rb index 72baac1f..49d35446 100644 --- a/lib/lhm/invoker.rb +++ b/lib/lhm/invoker.rb @@ -44,10 +44,14 @@ def run(options = {}) Entangler.new(migration, @connection).run do Chunker.new(migration, @connection, options).run - if options[:atomic_switch] - AtomicSwitcher.new(migration, @connection).run + if options[:disable_switcher] + Lhm.logger.debug 'switcher is disabled' else - LockedSwitcher.new(migration, @connection).run + if options[:atomic_switch] + AtomicSwitcher.new(migration, @connection).run + else + LockedSwitcher.new(migration, @connection).run + end end end end