Class: Migflow::Analyzers::AuditAnalyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/migflow/analyzers/audit_analyzer.rb

Constant Summary collapse

RULES =
[
  Rules::MissingIndexRule,
  Rules::MissingForeignKeyRule,
  Rules::StringWithoutLimitRule,
  Rules::MissingTimestampsRule,
  Rules::DangerousMigrationRule,
  Rules::NullColumnWithoutDefaultRule
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(snapshot:, raw_migrations:) ⇒ AuditAnalyzer

Returns a new instance of AuditAnalyzer.



27
28
29
30
# File 'lib/migflow/analyzers/audit_analyzer.rb', line 27

def initialize(snapshot:, raw_migrations:)
  @snapshot        = snapshot
  @raw_migrations  = raw_migrations
end

Class Method Details

.call(snapshot:, raw_migrations: []) ⇒ Object



23
24
25
# File 'lib/migflow/analyzers/audit_analyzer.rb', line 23

def self.call(snapshot:, raw_migrations: [])
  new(snapshot: snapshot, raw_migrations: raw_migrations).analyze
end

Instance Method Details

#analyzeObject



32
33
34
# File 'lib/migflow/analyzers/audit_analyzer.rb', line 32

def analyze
  schema_warnings + migration_warnings
end