Class: SlashMigrate::SchemaInspector::Table
- Inherits:
-
Object
- Object
- SlashMigrate::SchemaInspector::Table
- Defined in:
- app/services/slash_migrate/schema_inspector.rb
Overview
A thin, read-only view over one table’s columns, indexes and foreign keys.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #columns ⇒ Object
- #foreign_keys ⇒ Object
- #indexes ⇒ Object
-
#initialize(name, connection) ⇒ Table
constructor
A new instance of Table.
- #primary_key ⇒ Object
Constructor Details
#initialize(name, connection) ⇒ Table
Returns a new instance of Table.
33 34 35 36 |
# File 'app/services/slash_migrate/schema_inspector.rb', line 33 def initialize(name, connection) @name = name @connection = connection end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
31 32 33 |
# File 'app/services/slash_migrate/schema_inspector.rb', line 31 def name @name end |
Instance Method Details
#columns ⇒ Object
38 39 40 |
# File 'app/services/slash_migrate/schema_inspector.rb', line 38 def columns @connection.columns(@name) end |
#foreign_keys ⇒ Object
46 47 48 |
# File 'app/services/slash_migrate/schema_inspector.rb', line 46 def foreign_keys @connection.foreign_keys(@name) end |
#indexes ⇒ Object
42 43 44 |
# File 'app/services/slash_migrate/schema_inspector.rb', line 42 def indexes @connection.indexes(@name) end |
#primary_key ⇒ Object
50 51 52 |
# File 'app/services/slash_migrate/schema_inspector.rb', line 50 def primary_key @connection.primary_key(@name) end |