diff --git a/lib/lhm/entangler.rb b/lib/lhm/entangler.rb index 28eb9de1..57502918 100644 --- a/lib/lhm/entangler.rb +++ b/lib/lhm/entangler.rb @@ -9,16 +9,15 @@ class Entangler include Command include SqlHelper - attr_reader :connection, :delete_trigger_after + attr_reader :connection # Creates entanglement between two tables. All creates, updates and deletes # to origin will be repeated on the destination table. - def initialize(migration, connection = nil, delete_trigger_after = true) + def initialize(migration, connection = nil) @intersection = migration.intersection @origin = migration.origin @destination = migration.destination @connection = connection - @delete_trigger_after = delete_trigger_after end def entangle @@ -86,7 +85,6 @@ def before end def after - return unless @delete_trigger_after untangle.each do |stmt| @connection.execute(tagged(stmt)) end diff --git a/lib/lhm/invoker.rb b/lib/lhm/invoker.rb index 037868ed..e3e44516 100644 --- a/lib/lhm/invoker.rb +++ b/lib/lhm/invoker.rb @@ -44,14 +44,10 @@ def run(options = {}) Entangler.new(migration, @connection, options[:delete_trigger_after] && true).run do Chunker.new(migration, @connection, options).run - if options[:disable_switcher] - Lhm.logger.debug 'switcher is disabled' + if options[:atomic_switch] + AtomicSwitcher.new(migration, @connection).run else - if options[:atomic_switch] - AtomicSwitcher.new(migration, @connection).run - else - LockedSwitcher.new(migration, @connection).run - end + LockedSwitcher.new(migration, @connection).run end end end