Class: RuboCop::Migration::StrongMigrationsChecker

Inherits:
Object
  • Object
show all
Includes:
StrongMigrations::Migration
Defined in:
lib/rubocop/migration/strong_migrations_checker.rb

Constant Summary collapse

SAFETY_ASSURED_WARNINGS =

StrongMigrations raises errors for potentially unsafe code, and relies on the user to add a ‘safety_assured { }` block to supress this warning. These warnings are unsupported by rubocop-migration for now.

[
  :add_column_json,
  :add_index_columns,
  :change_table,
  :execute,
  :remove_column,
].freeze

Instance Method Summary collapse

Instance Method Details

#check_operation(method_name, *args) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/rubocop/migration/strong_migrations_checker.rb', line 25

def check_operation(method_name, *args)
  send(method_name, *args)
rescue StrongMigrations::UnsafeMigration => e
  strip_wait_message(e.message)
rescue NoMethodError
  # Do nothing, this method is unrecognized by StrongMigrations unsafe
  # operations and is likely safe.
end

#postgresql?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/rubocop/migration/strong_migrations_checker.rb', line 21

def postgresql?
  true
end

#version_safe?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/rubocop/migration/strong_migrations_checker.rb', line 17

def version_safe?
  false
end