Sha256: cbb082ed11b66d4159b4c9f1734ea5636672942f14678fe6c6cbe59959e42c4e

Contents?: true

Size: 857 Bytes

Versions: 27

Compression:

Stored size: 857 Bytes

Contents

# frozen_string_literal: true
module Lhm
  module TestMigrator
    def initialize(*)
      super
      @name = @origin.name
    end

    def execute
      @statements.each do |stmt|
        @connection.execute(tagged(stmt))
      end
    end
  end

  module TestInvoker
    def run(options = {})
      normalize_options(options)
      set_session_lock_wait_timeouts
      @migrator.run
    rescue => e
      Lhm.logger.error("LHM run failed with exception=#{e.class} message=#{e.message}")
      raise
    end
  end

  # Patch LHM to execute ALTER TABLE directly on original tables,
  # without the online migration dance.
  # This mode is designed for local/CI environments where we can speed
  # things up by not invoking "real" LHM logic.
  def self.execute_inline!
    Lhm::Migrator.prepend(TestMigrator)
    Lhm::Invoker.prepend(TestInvoker)
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
lhm-shopify-4.4.2 lib/lhm/test_support.rb
lhm-shopify-4.4.1 lib/lhm/test_support.rb
lhm-shopify-4.4.0 lib/lhm/test_support.rb
lhm-shopify-4.3.0 lib/lhm/test_support.rb
lhm-shopify-4.2.3 lib/lhm/test_support.rb
lhm-shopify-4.2.2 lib/lhm/test_support.rb
lhm-shopify-4.2.1 lib/lhm/test_support.rb
lhm-shopify-4.2.0 lib/lhm/test_support.rb
lhm-shopify-4.1.1 lib/lhm/test_support.rb
lhm-shopify-4.1.0 lib/lhm/test_support.rb
lhm-shopify-4.0.0 lib/lhm/test_support.rb
lhm-teak-3.6.4 lib/lhm/test_support.rb
lhm-teak-3.6.3 lib/lhm/test_support.rb
lhm-teak-3.6.2 lib/lhm/test_support.rb
lhm-teak-3.6.1 lib/lhm/test_support.rb
lhm-teak-3.6.0 lib/lhm/test_support.rb
lhm-shopify-3.5.5 lib/lhm/test_support.rb
lhm-shopify-3.5.4 lib/lhm/test_support.rb
lhm-shopify-3.5.3 lib/lhm/test_support.rb
lhm-shopify-3.5.2 lib/lhm/test_support.rb