Class: Pinspec::SchemaGraph
- Inherits:
-
Data
- Object
- Data
- Pinspec::SchemaGraph
- Defined in:
- lib/pinspec/types.rb
Instance Attribute Summary collapse
-
#fk_map ⇒ Object
readonly
Returns the value of attribute fk_map.
-
#foreign_keys ⇒ Object
readonly
Returns the value of attribute foreign_keys.
-
#skipped_statements ⇒ Object
readonly
Returns the value of attribute skipped_statements.
-
#tables ⇒ Object
readonly
Returns the value of attribute tables.
Instance Method Summary collapse
- #fk_for(table_name, column_name) ⇒ Object
- #foreign_keys_from(table_name) ⇒ Object
- #table(name) ⇒ Object
- #table_names ⇒ Object
- #unknown_columns ⇒ Object
Instance Attribute Details
#fk_map ⇒ Object (readonly)
Returns the value of attribute fk_map
422 423 424 |
# File 'lib/pinspec/types.rb', line 422 def fk_map @fk_map end |
#foreign_keys ⇒ Object (readonly)
Returns the value of attribute foreign_keys
422 423 424 |
# File 'lib/pinspec/types.rb', line 422 def foreign_keys @foreign_keys end |
#skipped_statements ⇒ Object (readonly)
Returns the value of attribute skipped_statements
422 423 424 |
# File 'lib/pinspec/types.rb', line 422 def skipped_statements @skipped_statements end |
#tables ⇒ Object (readonly)
Returns the value of attribute 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_names ⇒ Object
427 428 429 |
# File 'lib/pinspec/types.rb', line 427 def table_names tables.map(&:name) end |
#unknown_columns ⇒ Object
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 |