module ActiveRecord::ConnectionAdapters::CockroachDB::ColumnDefinitionUtils

Public Class Methods

default_srid(options) click to toggle source
# File lib/active_record/connection_adapters/cockroachdb/table_definition.rb, line 49
def default_srid(options)
  options[:geographic] ? 4326 : CockroachDBAdapter::DEFAULT_SRID
end
geo_type(type = 'GEOMETRY') click to toggle source
# File lib/active_record/connection_adapters/cockroachdb/table_definition.rb, line 33
def geo_type(type = 'GEOMETRY')
  g_type = type.to_s.delete('_').upcase
  return 'POINT' if g_type == 'STPOINT'
  return 'POLYGON' if g_type == 'STPOLYGON'

  g_type
end
limit_from_options(type, options = {}) click to toggle source
# File lib/active_record/connection_adapters/cockroachdb/table_definition.rb, line 41
def limit_from_options(type, options = {})
  spatial_type = geo_type(type)
  spatial_type << 'Z' if options[:has_z]
  spatial_type << 'M' if options[:has_m]
  spatial_type << ",#{options[:srid] || default_srid(options)}"
  spatial_type
end