Class: Pinspec::SchemaGraph

Inherits:
Data
  • Object
show all
Defined in:
lib/pinspec/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fk_mapObject (readonly)

Returns the value of attribute fk_map

Returns:

  • (Object)

    the current value of fk_map



422
423
424
# File 'lib/pinspec/types.rb', line 422

def fk_map
  @fk_map
end

#foreign_keysObject (readonly)

Returns the value of attribute foreign_keys

Returns:

  • (Object)

    the current value of foreign_keys



422
423
424
# File 'lib/pinspec/types.rb', line 422

def foreign_keys
  @foreign_keys
end

#skipped_statementsObject (readonly)

Returns the value of attribute skipped_statements

Returns:

  • (Object)

    the current value of skipped_statements



422
423
424
# File 'lib/pinspec/types.rb', line 422

def skipped_statements
  @skipped_statements
end

#tablesObject (readonly)

Returns the value of attribute tables

Returns:

  • (Object)

    the current value of tables



422
423
424
# File 'lib/pinspec/types.rb', line 422

def tables
  @tables
end

Instance Method Details

#fk_for(table_name, column_name) ⇒ Object



431
432
433
# File 'lib/pinspec/types.rb', line 431

def fk_for(table_name, column_name)
  foreign_keys.find { |fk| fk.from_table == table_name.to_s && fk.column == column_name.to_s }
end

#foreign_keys_from(table_name) ⇒ Object



435
436
437
# File 'lib/pinspec/types.rb', line 435

def foreign_keys_from(table_name)
  foreign_keys.select { |fk| fk.from_table == table_name.to_s }
end

#table(name) ⇒ Object



423
424
425
# File 'lib/pinspec/types.rb', line 423

def table(name)
  tables.find { |t| t.name == name.to_s }
end

#table_namesObject



427
428
429
# File 'lib/pinspec/types.rb', line 427

def table_names
  tables.map(&:name)
end

#unknown_columnsObject



439
440
441
# File 'lib/pinspec/types.rb', line 439

def unknown_columns
  tables.flat_map { |t| t.columns.select(&:unknown_type?).map { |c| [t.name, c] } }
end