Module: PostgresExt::Postgis::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter

Defined in:
lib/postgres_ext/postgis/active_record/connection_adapters/postgresql_adapter.rb

Defined Under Namespace

Modules: ColumnDefinition, ColumnMethods, OID, Quoting, SchemaCreation, TableDefinition

Constant Summary collapse

POSTGIS_DATABASE_TYPES =
{
  geometry: { name: 'geometry' }
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(klass) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/postgres_ext/postgis/active_record/connection_adapters/postgresql_adapter.rb', line 6

def self.prepended(klass)
  klass::NATIVE_DATABASE_TYPES.merge! POSTGIS_DATABASE_TYPES
  klass::TableDefinition.send :prepend, TableDefinition
  klass::ColumnDefinition.send :prepend, ColumnDefinition
  klass::SchemaCreation.send :prepend, SchemaCreation
  klass::OID.send :prepend, OID
  klass.send :prepend, Quoting
end

Instance Method Details

#migration_keysObject



28
29
30
# File 'lib/postgres_ext/postgis/active_record/connection_adapters/postgresql_adapter.rb', line 28

def migration_keys
  super + [:srid, :geometry_type]
end

#prepare_column_options(column, types) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/postgres_ext/postgis/active_record/connection_adapters/postgresql_adapter.rb', line 15

def prepare_column_options(column, types)
  spec = super

  if column.type == :geometry
    if column.srid
      spec[:srid] = column.srid
      spec[:geometry_type] = column.geometry_type
    end
  end

  spec
end