Skip to content

Commit

Permalink
Remove disable_switcher flag
Browse files Browse the repository at this point in the history
  • Loading branch information
perryism committed Jan 27, 2018
1 parent 122b5ff commit ff23c4d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
1 change: 0 additions & 1 deletion lib/lhm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions lib/lhm/entangler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -86,7 +85,6 @@ def before
end

def after
return unless @delete_trigger_after
untangle.each do |stmt|
@connection.execute(tagged(stmt))
end
Expand Down
10 changes: 3 additions & 7 deletions lib/lhm/invoker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ff23c4d

Please sign in to comment.