module ActiveRecord::SaferMigrations::Migration::ClassMethods

Public Instance Methods

disable_lock_timeout!() click to toggle source
# File lib/active_record/safer_migrations/migration.rb, line 49
def disable_lock_timeout!
  say "WARNING: disabling the lock timeout. This is very dangerous."
  self.lock_timeout = 0
end
disable_statement_timeout!() click to toggle source
# File lib/active_record/safer_migrations/migration.rb, line 66
def disable_statement_timeout!
  say "WARNING: disabling the statement timeout. This is very dangerous."
  self.statement_timeout = 0
end
set_lock_timeout(timeout) click to toggle source

rubocop:disable Naming/AccessorMethodName

# File lib/active_record/safer_migrations/migration.rb, line 38
def set_lock_timeout(timeout)
  # rubocop:enable Naming/AccessorMethodName
  if timeout.zero?
    raise "Setting lock_timeout to 0 is dangerous - it disables the lock " \
          "timeout rather than instantly timing out. If you *actually* " \
          "want to disable the lock timeout (not recommended!), use the " \
          "`disable_lock_timeout!` method."
  end
  self.lock_timeout = timeout
end
set_statement_timeout(timeout) click to toggle source

rubocop:disable Naming/AccessorMethodName

# File lib/active_record/safer_migrations/migration.rb, line 55
def set_statement_timeout(timeout)
  # rubocop:enable Naming/AccessorMethodName
  if timeout.zero?
    raise "Setting statement_timeout to 0 is dangerous - it disables the " \
          "statement timeout rather than instantly timing out. If you " \
          "*actually* want to disable the statement timeout (not recommended!)" \
          ", use the `disable_statement_timeout!` method."
  end
  self.statement_timeout = timeout
end