Class: ActiveRecord::ConnectionAdapters::Spanner::TableDefinition
- Inherits:
-
TableDefinition
- Object
- TableDefinition
- ActiveRecord::ConnectionAdapters::Spanner::TableDefinition
- Defined in:
- lib/active_record/connection_adapters/spanner/schema_definitions.rb
Instance Attribute Summary collapse
-
#interleave_in_parent ⇒ Object
readonly
Returns the value of attribute interleave_in_parent.
Instance Method Summary collapse
- #interleave_in(parent, on_delete = nil) ⇒ Object
- #interleave_in? ⇒ Boolean
- #new_column_definition(name, type, **options) ⇒ Object
- #on_delete ⇒ Object
- #parent_key(name, type: nil) ⇒ Object
- #references(*args, **options) ⇒ Object (also: #belongs_to)
- #valid_column_definition_options ⇒ Object
Instance Attribute Details
#interleave_in_parent ⇒ Object (readonly)
Returns the value of attribute interleave_in_parent.
11 12 13 |
# File 'lib/active_record/connection_adapters/spanner/schema_definitions.rb', line 11 def interleave_in_parent @interleave_in_parent end |
Instance Method Details
#interleave_in(parent, on_delete = nil) ⇒ Object
13 14 15 16 |
# File 'lib/active_record/connection_adapters/spanner/schema_definitions.rb', line 13 def interleave_in parent, on_delete = nil @interleave_in_parent = parent @on_delete = on_delete end |
#interleave_in? ⇒ Boolean
22 23 24 |
# File 'lib/active_record/connection_adapters/spanner/schema_definitions.rb', line 22 def interleave_in? @interleave_in_parent != nil end |
#new_column_definition(name, type, **options) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/active_record/connection_adapters/spanner/schema_definitions.rb', line 37 def new_column_definition name, type, ** case type when :virtual type = [:type] end super end |
#on_delete ⇒ Object
26 27 28 |
# File 'lib/active_record/connection_adapters/spanner/schema_definitions.rb', line 26 def on_delete "CASCADE" if @on_delete == :cascade end |
#parent_key(name, type: nil) ⇒ Object
18 19 20 |
# File 'lib/active_record/connection_adapters/spanner/schema_definitions.rb', line 18 def parent_key name, type: nil column name, :parent_key, null: false, passed_type: type end |
#references(*args, **options) ⇒ Object Also known as: belongs_to
30 31 32 33 34 |
# File 'lib/active_record/connection_adapters/spanner/schema_definitions.rb', line 30 def references *args, ** args.each do |ref_name| Spanner::ReferenceDefinition.new(ref_name, **).add_to(self) end end |
#valid_column_definition_options ⇒ Object
46 47 48 |
# File 'lib/active_record/connection_adapters/spanner/schema_definitions.rb', line 46 def super + [:type, :array, :allow_commit_timestamp, :as, :stored, :parent_key, :passed_type, :index] end |