module MigrationLockTimeout::LockManager

Public Instance Methods

migrate(direction) click to toggle source
Calls superclass method
# File lib/migration_lock_timeout/lock_manager.rb, line 4
def migrate(direction)
  timeout_disabled = self.class.disable_lock_timeout
  time = self.class.lock_timeout_override ||
    MigrationLockTimeout.try(:config).try(:default_timeout)
  if !timeout_disabled && direction == :up && time && !disable_ddl_transaction
    safety_assured? do
      execute "SET LOCAL lock_timeout = '#{time}s'"
    end
  end
  super
end
safety_assured?() { || ... } click to toggle source
# File lib/migration_lock_timeout/lock_manager.rb, line 16
def safety_assured?
  if defined?(StrongMigrations)
    safety_assured { yield }
  else
    yield
  end
end