Class: ActiveRecord::ConnectionAdapters::CockroachDB::TableDefinition
- Inherits:
-
PostgreSQL::TableDefinition
- Object
- PostgreSQL::TableDefinition
- ActiveRecord::ConnectionAdapters::CockroachDB::TableDefinition
- Includes:
- ColumnMethods
- Defined in:
- lib/active_record/connection_adapters/cockroachdb/table_definition.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#new_column_definition(name, type, **options) ⇒ Object
Support for spatial columns in tables super: github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb.
Methods included from ColumnMethods
#geography, #geometry, #geometry_collection, #line_string, #multi_line_string, #multi_point, #multi_polygon, #spatial, #st_point, #st_polygon
Instance Method Details
#new_column_definition(name, type, **options) ⇒ Object
Support for spatial columns in tables super: github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/active_record/connection_adapters/cockroachdb/table_definition.rb', line 25 def new_column_definition(name, type, **) if (info = CockroachDBAdapter.(type.to_sym)) if (limit = .delete(:limit)) && limit.is_a?(::Hash) .merge!(limit) end geo_type = ColumnDefinitionUtils.geo_type([:type] || type || info[:type]) base_type = info[:type] || ([:geographic] ? :geography : :geometry) [:limit] = ColumnDefinitionUtils.(geo_type, ) [:spatial_type] = geo_type column = super(name, base_type, **) else column = super(name, type, **) end column end |