From ff23c4d228c6558cb1e797b7de1d23b7e568de76 Mon Sep 17 00:00:00 2001 From: Perry Date: Fri, 26 Jan 2018 16:11:49 -0800 Subject: [PATCH] Remove disable_switcher flag --- lib/lhm.rb | 1 - lib/lhm/entangler.rb | 6 ++---- lib/lhm/invoker.rb | 10 +++------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/lhm.rb b/lib/lhm.rb index d6409e63..2bbbc78b 100644 --- a/lib/lhm.rb +++ b/lib/lhm.rb @@ -55,7 +55,6 @@ def sync_table(table_name, sync_table, options = {}, &block) origin = Table.parse(table_name, connection) invoker = SyncInvoker.new(origin, connection) block.call(invoker.migrator) - options.merge!({disable_switcher: true, delete_trigger_after: false}) invoker.run(options) ensure Lhm::Table.naming_strategy = nil 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