Class: ActiveRecordSpannerAdapter::Table
- Inherits:
-
Object
- Object
- ActiveRecordSpannerAdapter::Table
- Defined in:
- lib/activerecord_spanner_adapter/table.rb,
lib/activerecord_spanner_adapter/table/column.rb
Defined Under Namespace
Classes: Column
Instance Attribute Summary collapse
-
#catalog ⇒ Object
Returns the value of attribute catalog.
-
#columns ⇒ Object
Returns the value of attribute columns.
-
#foreign_keys ⇒ Object
Returns the value of attribute foreign_keys.
-
#indexes ⇒ Object
Returns the value of attribute indexes.
-
#name ⇒ Object
Returns the value of attribute name.
-
#on_delete ⇒ Object
Returns the value of attribute on_delete.
-
#parent_table ⇒ Object
Returns the value of attribute parent_table.
-
#schema_name ⇒ Object
Returns the value of attribute schema_name.
Instance Method Summary collapse
- #cascade? ⇒ Boolean
-
#initialize(name, parent_table: nil, on_delete: nil, schema_name: nil, catalog: nil) ⇒ Table
constructor
parent_table == interleave_in.
- #primary_keys ⇒ Object
Constructor Details
#initialize(name, parent_table: nil, on_delete: nil, schema_name: nil, catalog: nil) ⇒ Table
parent_table == interleave_in
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/activerecord_spanner_adapter/table.rb', line 21 def initialize \ name, parent_table: nil, on_delete: nil, schema_name: nil, catalog: nil @name = name.to_s @parent_table = parent_table.to_s if parent_table @on_delete = on_delete @schema_name = schema_name @catalog = catalog @columns = [] @indexes = [] @foreign_keys = [] end |
Instance Attribute Details
#catalog ⇒ Object
Returns the value of attribute catalog.
15 16 17 |
# File 'lib/activerecord_spanner_adapter/table.rb', line 15 def catalog @catalog end |
#columns ⇒ Object
Returns the value of attribute columns.
17 18 19 |
# File 'lib/activerecord_spanner_adapter/table.rb', line 17 def columns @columns end |
#foreign_keys ⇒ Object
Returns the value of attribute foreign_keys.
18 19 20 |
# File 'lib/activerecord_spanner_adapter/table.rb', line 18 def foreign_keys @foreign_keys end |
#indexes ⇒ Object
Returns the value of attribute indexes.
16 17 18 |
# File 'lib/activerecord_spanner_adapter/table.rb', line 16 def indexes @indexes end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/activerecord_spanner_adapter/table.rb', line 11 def name @name end |
#on_delete ⇒ Object
Returns the value of attribute on_delete.
12 13 14 |
# File 'lib/activerecord_spanner_adapter/table.rb', line 12 def on_delete @on_delete end |
#parent_table ⇒ Object
Returns the value of attribute parent_table.
13 14 15 |
# File 'lib/activerecord_spanner_adapter/table.rb', line 13 def parent_table @parent_table end |
#schema_name ⇒ Object
Returns the value of attribute schema_name.
14 15 16 |
# File 'lib/activerecord_spanner_adapter/table.rb', line 14 def schema_name @schema_name end |
Instance Method Details
#cascade? ⇒ Boolean
41 42 43 |
# File 'lib/activerecord_spanner_adapter/table.rb', line 41 def cascade? @on_delete == "CASCADE" end |
#primary_keys ⇒ Object
37 38 39 |
# File 'lib/activerecord_spanner_adapter/table.rb', line 37 def primary_keys columns.select(&:primary_key).map(&:name) end |