Sha256: 412c6b17236f58be4e34fcfda9a90fcbaad57090f2bdefd4e0048be728039322

Contents?: true

Size: 1.35 KB

Versions: 27

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

module ActiveRecord
  module ConnectionAdapters
    module CockroachDB
      module ColumnMethods
        def spatial(name, options = {})
          raise "You must set a type. For example: 't.spatial type: :st_point'" unless options[:type]

          column(name, options[:type], **options)
        end

        def geography(name, options = {})
          column(name, :geography, **options)
        end

        def geometry(name, options = {})
          column(name, :geometry, **options)
        end

        def geometry_collection(name, options = {})
          column(name, :geometry_collection, **options)
        end

        def line_string(name, options = {})
          column(name, :line_string, **options)
        end

        def multi_line_string(name, options = {})
          column(name, :multi_line_string, **options)
        end

        def multi_point(name, options = {})
          column(name, :multi_point, **options)
        end

        def multi_polygon(name, options = {})
          column(name, :multi_polygon, **options)
        end

        def st_point(name, options = {})
          column(name, :st_point, **options)
        end

        def st_polygon(name, options = {})
          column(name, :st_polygon, **options)
        end
      end
    end

    PostgreSQL::Table.include CockroachDB::ColumnMethods
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
activerecord-cockroachdb-adapter-6.0.0.pre.beta.5 lib/active_record/connection_adapters/cockroachdb/column_methods.rb
activerecord-cockroachdb-adapter-6.1.0.pre.beta.3 lib/active_record/connection_adapters/cockroachdb/column_methods.rb
activerecord-cockroachdb-adapter-6.1.0.pre.beta.2 lib/active_record/connection_adapters/cockroachdb/column_methods.rb
activerecord-cockroachdb-adapter-6.0.0.pre.beta.4 lib/active_record/connection_adapters/cockroachdb/column_methods.rb
activerecord-cockroachdb-adapter-6.1.0beta1 lib/active_record/connection_adapters/cockroachdb/column_methods.rb
activerecord-cockroachdb-adapter-6.0.0beta3 lib/active_record/connection_adapters/cockroachdb/column_methods.rb
activerecord-cockroachdb-adapter-5.2.2 lib/active_record/connection_adapters/cockroachdb/column_methods.rb