activerecord-postgis-adapter 6.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/active_record/connection_adapters/postgis/column_methods.rb +10 -10
- data/lib/active_record/connection_adapters/postgis/schema_statements.rb +5 -5
- data/lib/active_record/connection_adapters/postgis/spatial_table_definition.rb +3 -3
- data/lib/active_record/connection_adapters/postgis/version.rb +1 -1
- data/lib/active_record/connection_adapters/postgis_adapter.rb +4 -16
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 978d238ad317f3e43d498f237d63573aa71291fe2485f2b35b0013e829bc0727
|
4
|
+
data.tar.gz: 2520a77cc0070c3afaa4fdba2d771ba05e9fb569186e35a4e92dd24816f43ae3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a9e6472022e69fbaf2d07dd76f98cdf97c440f6009a26ccd59d1b580ca4ff3590b889e0c1afe9addb2f518e88decec6e1107a5b0301c12ce19b9df5e22073ff
|
7
|
+
data.tar.gz: 102a2b33b86298a52ae3dac860bf75d0531ad32974b914f2e5ebc154d6d22c21c371770d6c649fa6abb7654984c5e3e3d4bdb6cab106ffb0304cd83f15f8e529
|
@@ -6,43 +6,43 @@ module ActiveRecord
|
|
6
6
|
module ColumnMethods
|
7
7
|
def spatial(name, options = {})
|
8
8
|
raise "You must set a type. For example: 't.spatial type: :st_point'" unless options[:type]
|
9
|
-
column(name, options[:type], options)
|
9
|
+
column(name, options[:type], **options)
|
10
10
|
end
|
11
11
|
|
12
12
|
def geography(name, options = {})
|
13
|
-
column(name, :geography, options)
|
13
|
+
column(name, :geography, **options)
|
14
14
|
end
|
15
15
|
|
16
16
|
def geometry(name, options = {})
|
17
|
-
column(name, :geometry, options)
|
17
|
+
column(name, :geometry, **options)
|
18
18
|
end
|
19
19
|
|
20
20
|
def geometry_collection(name, options = {})
|
21
|
-
column(name, :geometry_collection, options)
|
21
|
+
column(name, :geometry_collection, **options)
|
22
22
|
end
|
23
23
|
|
24
24
|
def line_string(name, options = {})
|
25
|
-
column(name, :line_string, options)
|
25
|
+
column(name, :line_string, **options)
|
26
26
|
end
|
27
27
|
|
28
28
|
def multi_line_string(name, options = {})
|
29
|
-
column(name, :multi_line_string, options)
|
29
|
+
column(name, :multi_line_string, **options)
|
30
30
|
end
|
31
31
|
|
32
32
|
def multi_point(name, options = {})
|
33
|
-
column(name, :multi_point, options)
|
33
|
+
column(name, :multi_point, **options)
|
34
34
|
end
|
35
35
|
|
36
36
|
def multi_polygon(name, options = {})
|
37
|
-
column(name, :multi_polygon, options)
|
37
|
+
column(name, :multi_polygon, **options)
|
38
38
|
end
|
39
39
|
|
40
40
|
def st_point(name, options = {})
|
41
|
-
column(name, :st_point, options)
|
41
|
+
column(name, :st_point, **options)
|
42
42
|
end
|
43
43
|
|
44
44
|
def st_polygon(name, options = {})
|
45
|
-
column(name, :st_polygon, options)
|
45
|
+
column(name, :st_polygon, **options)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -35,7 +35,7 @@ module ActiveRecord
|
|
35
35
|
end
|
36
36
|
|
37
37
|
# override
|
38
|
-
# https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb#
|
38
|
+
# https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb#L544
|
39
39
|
#
|
40
40
|
# returns Postgresql sql type string
|
41
41
|
# examples:
|
@@ -74,8 +74,8 @@ module ActiveRecord
|
|
74
74
|
end
|
75
75
|
|
76
76
|
# override
|
77
|
-
def create_table_definition(*args)
|
78
|
-
PostGIS::TableDefinition.new(self, *args)
|
77
|
+
def create_table_definition(*args, **kwargs)
|
78
|
+
PostGIS::TableDefinition.new(self, *args, **kwargs)
|
79
79
|
end
|
80
80
|
|
81
81
|
# memoize hash of column infos for tables
|
@@ -85,8 +85,6 @@ module ActiveRecord
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def initialize_type_map(map = type_map)
|
88
|
-
super
|
89
|
-
|
90
88
|
%w(
|
91
89
|
geography
|
92
90
|
geometry
|
@@ -102,6 +100,8 @@ module ActiveRecord
|
|
102
100
|
OID::Spatial.new(oid, sql_type)
|
103
101
|
end
|
104
102
|
end
|
103
|
+
|
104
|
+
super
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
@@ -7,7 +7,7 @@ module ActiveRecord # :nodoc:
|
|
7
7
|
include ColumnMethods
|
8
8
|
|
9
9
|
# super: https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
|
10
|
-
def new_column_definition(name, type, options)
|
10
|
+
def new_column_definition(name, type, **options)
|
11
11
|
if (info = PostGISAdapter.spatial_column_options(type.to_sym))
|
12
12
|
if (limit = options.delete(:limit))
|
13
13
|
options.merge!(limit) if limit.is_a?(::Hash)
|
@@ -18,9 +18,9 @@ module ActiveRecord # :nodoc:
|
|
18
18
|
|
19
19
|
options[:limit] = ColumnDefinitionUtils.limit_from_options(geo_type, options)
|
20
20
|
options[:spatial_type] = geo_type
|
21
|
-
column = super(name, base_type, options)
|
21
|
+
column = super(name, base_type, **options)
|
22
22
|
else
|
23
|
-
column = super(name, type, options)
|
23
|
+
column = super(name, type, **options)
|
24
24
|
end
|
25
25
|
|
26
26
|
column
|
@@ -38,7 +38,7 @@ end
|
|
38
38
|
module ActiveRecord
|
39
39
|
module ConnectionAdapters
|
40
40
|
class PostGISAdapter < PostgreSQLAdapter
|
41
|
-
|
41
|
+
ADAPTER_NAME = 'PostGIS'.freeze
|
42
42
|
|
43
43
|
SPATIAL_COLUMN_OPTIONS =
|
44
44
|
{
|
@@ -57,22 +57,10 @@ module ActiveRecord
|
|
57
57
|
# http://postgis.17.x6.nabble.com/Default-SRID-td5001115.html
|
58
58
|
DEFAULT_SRID = 0
|
59
59
|
|
60
|
-
|
61
|
-
def initialize(connection, logger, connection_parameters, config)
|
62
|
-
super
|
63
|
-
|
64
|
-
@visitor = Arel::Visitors::PostGIS.new(self)
|
65
|
-
# copy from https://github.com/rails/rails/blob/6ece7df8d80c6d93db43878fa4c0278a0204072c/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L199
|
66
|
-
if self.class.type_cast_config_to_boolean(config.fetch(:prepared_statements) { true })
|
67
|
-
@prepared_statements = true
|
68
|
-
@visitor.extend(DetermineIfPreparableVisitor)
|
69
|
-
else
|
70
|
-
@prepared_statements = false
|
71
|
-
end
|
72
|
-
end
|
60
|
+
include PostGIS::SchemaStatements
|
73
61
|
|
74
|
-
def
|
75
|
-
|
62
|
+
def arel_visitor # :nodoc:
|
63
|
+
Arel::Visitors::PostGIS.new(self)
|
76
64
|
end
|
77
65
|
|
78
66
|
def self.spatial_column_options(key)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-postgis-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.
|
4
|
+
version: 6.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma, Tee Parham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
requirements: []
|
140
|
-
rubygems_version: 3.
|
140
|
+
rubygems_version: 3.1.2
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: ActiveRecord adapter for PostGIS, based on RGeo.
|