Class: ActiveRecordSpannerAdapter::ForeignKey

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord_spanner_adapter/foreign_key.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table_name, name, columns, ref_table, ref_columns, on_delete: nil, on_update: nil, table_schema: "", ref_schema: "") ⇒ ForeignKey

Returns a new instance of ForeignKey.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/activerecord_spanner_adapter/foreign_key.rb', line 19

def initialize \
    table_name,
    name,
    columns,
    ref_table,
    ref_columns,
    on_delete: nil,
    on_update: nil,
    table_schema: "",
    ref_schema: ""
  @table_schema = table_schema
  @table_name = table_name
  @name = name
  @columns = Array(columns)
  @ref_schema = ref_schema
  @ref_table = ref_table
  @ref_columns = Array(ref_columns)
  @on_delete = on_delete unless on_delete == "NO ACTION"
  @on_update = on_update unless on_update == "NO ACTION"
end

Instance Attribute Details

#columnsObject

Returns the value of attribute columns.



12
13
14
# File 'lib/activerecord_spanner_adapter/foreign_key.rb', line 12

def columns
  @columns
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/activerecord_spanner_adapter/foreign_key.rb', line 11

def name
  @name
end

#on_deleteObject

Returns the value of attribute on_delete.



16
17
18
# File 'lib/activerecord_spanner_adapter/foreign_key.rb', line 16

def on_delete
  @on_delete
end

#on_updateObject

Returns the value of attribute on_update.



17
18
19
# File 'lib/activerecord_spanner_adapter/foreign_key.rb', line 17

def on_update
  @on_update
end

#ref_columnsObject

Returns the value of attribute ref_columns.



15
16
17
# File 'lib/activerecord_spanner_adapter/foreign_key.rb', line 15

def ref_columns
  @ref_columns
end

#ref_schemaObject

Returns the value of attribute ref_schema.



13
14
15
# File 'lib/activerecord_spanner_adapter/foreign_key.rb', line 13

def ref_schema
  @ref_schema
end

#ref_tableObject

Returns the value of attribute ref_table.



14
15
16
# File 'lib/activerecord_spanner_adapter/foreign_key.rb', line 14

def ref_table
  @ref_table
end

#table_nameObject

Returns the value of attribute table_name.



10
11
12
# File 'lib/activerecord_spanner_adapter/foreign_key.rb', line 10

def table_name
  @table_name
end

#table_schemaObject

Returns the value of attribute table_schema.



9
10
11
# File 'lib/activerecord_spanner_adapter/foreign_key.rb', line 9

def table_schema
  @table_schema
end