Method: Dbwatcher::Services::DiagramAnalyzers::InferredRelationshipAnalyzer#analyze

Defined in:
lib/dbwatcher/services/diagram_analyzers/inferred_relationship_analyzer.rb

#analyze(_context) ⇒ Array<Hash>

Analyze inferred relationships

Parameters:

  • context (Hash)

    analysis context

Returns:

  • (Array<Hash>)

    array of inferred relationship data



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/dbwatcher/services/diagram_analyzers/inferred_relationship_analyzer.rb', line 31

def analyze(_context)
  return [] unless schema_available?

  Rails.logger.debug "InferredRelationshipAnalyzer: Starting analysis with #{tables_to_analyze.length} tables"
  relationships = []

  # Analyze naming convention relationships
  relationships.concat(analyze_naming_conventions)

  # Analyze junction tables
  relationships.concat(analyze_junction_tables)

  # Analyze column patterns
  relationships.concat(analyze_column_patterns)

  Rails.logger.info "InferredRelationshipAnalyzer: Found #{relationships.length} inferred relationships"
  relationships
end