class ActiveRecord::ConnectionAdapters::Spanner::ReferenceDefinition
Public Class Methods
new(\ name, polymorphic: false, index: true, foreign_key: false, type: :integer, **options)
click to toggle source
# File lib/active_record/connection_adapters/spanner/schema_definitions.rb, line 52 def initialize \ name, polymorphic: false, index: true, foreign_key: false, type: :integer, **options @name = name @polymorphic = polymorphic @foreign_key = foreign_key # Only add an index if there is no foreign key, as Cloud Spanner will automatically add a managed index when # a foreign key is added. @index = index unless foreign_key @type = type @options = options return unless polymorphic && foreign_key raise ArgumentError, "Cannot add a foreign key to a polymorphic relation" end
Private Instance Methods
columns()
click to toggle source
# File lib/active_record/connection_adapters/spanner/schema_definitions.rb, line 74 def columns result = [[column_name, type, options]] if polymorphic type_options = polymorphic_options.merge limit: 255 result.unshift ["#{name}_type", :string, type_options] end result end