Class: Migflow::Analyzers::Rules::DangerousMigrationRule

Inherits:
BaseRule
  • Object
show all
Defined in:
lib/migflow/analyzers/rules/dangerous_migration_rule.rb

Constant Summary collapse

DANGEROUS_OPERATIONS =
{
  remove_column: "Removes a column — may break running app instances",
  drop_table: "Drops a table — destructive and irreversible",
  rename_column: "Renames a column — breaks existing queries and code"
}.freeze

Instance Method Summary collapse

Instance Method Details

#call(_tables) ⇒ Object



13
14
15
# File 'lib/migflow/analyzers/rules/dangerous_migration_rule.rb', line 13

def call(_tables)
  []
end

#call_with_migrations(raw_migrations) ⇒ Object



17
18
19
20
21
# File 'lib/migflow/analyzers/rules/dangerous_migration_rule.rb', line 17

def call_with_migrations(raw_migrations)
  raw_migrations.flat_map do |migration|
    detect_dangers(migration[:raw_content], migration[:filename])
  end
end