activerecord-trilogis-adapter 8.0.2 → 8.1.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/trilogis/schema_statements.rb +9 -0
- data/lib/active_record/connection_adapters/trilogis/spatial_column.rb +8 -3
- data/lib/active_record/connection_adapters/trilogis/version.rb +1 -1
- data/lib/active_record/type/spatial.rb +11 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 30266da053b3f001b74a6f0fcbcfffe26b11a0205f1e1a2164584f53b995bc21
|
|
4
|
+
data.tar.gz: ea5ca2afb3df8e11d9697cecb5e1ef5e06209158d1db3178c111c1a3f3aafb9d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3cd09501502ce9bd8dd42ddbee0e27c88f4285a6c6d9df63cef047e31f1bfa8e6e89aee123c58190b20e089c26a0c5122ff841258d1a6d4b35fec58363bfb523
|
|
7
|
+
data.tar.gz: ef2a9ed811ce28e493d41a5fcd5bebb8ae7b9a4f34400b80ac80e02cf1f6149d288de532e2133a84a93d21aa757704752f0d5a9cfe125624e399f3d617a38db7
|
|
@@ -162,10 +162,19 @@ module ActiveRecord
|
|
|
162
162
|
# Build a spatial column from field metadata
|
|
163
163
|
def build_spatial_column(table_name, field, field_name, sql_type)
|
|
164
164
|
spatial_info = spatial_column_info(table_name).get(field_name, sql_type)
|
|
165
|
+
|
|
166
|
+
# Keep original sql_type in metadata (point, linestring, etc.)
|
|
167
|
+
# This preserves the actual geometric type for @geo_type_name
|
|
165
168
|
type_metadata = fetch_type_metadata(sql_type)
|
|
166
169
|
|
|
170
|
+
# Lookup cast type as "geometry" for schema dumper compatibility
|
|
171
|
+
# Schema dumper validates cast_type, and only "geometry" is registered as table method
|
|
172
|
+
# Actual type is preserved in sql_type_metadata and limit hash
|
|
173
|
+
cast_type = lookup_cast_type("geometry")
|
|
174
|
+
|
|
167
175
|
SpatialColumn.new(
|
|
168
176
|
field_name,
|
|
177
|
+
cast_type,
|
|
169
178
|
nil, # MySQL spatial columns cannot have DEFAULT values
|
|
170
179
|
type_metadata,
|
|
171
180
|
extract_field_value(field, :Null, :null) == "YES",
|
|
@@ -27,11 +27,13 @@ module ActiveRecord
|
|
|
27
27
|
"geometrycollection" => RGeo::Feature::GeometryCollection
|
|
28
28
|
}.freeze
|
|
29
29
|
|
|
30
|
-
def initialize(name, default, sql_type_metadata = nil, null = true,
|
|
30
|
+
def initialize(name, cast_type, default, sql_type_metadata = nil, null = true,
|
|
31
31
|
default_function = nil, collation: nil, comment: nil, spatial_info: nil, **)
|
|
32
|
-
super(name, default, sql_type_metadata, null, default_function,
|
|
32
|
+
super(name, cast_type, default, sql_type_metadata, null, default_function,
|
|
33
|
+
collation: collation, comment: comment)
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
# Guard against nil cast_type during OID registration
|
|
36
|
+
return unless cast_type && spatial?
|
|
35
37
|
|
|
36
38
|
if spatial_info
|
|
37
39
|
# Use spatial info from INFORMATION_SCHEMA if available
|
|
@@ -52,6 +54,9 @@ module ActiveRecord
|
|
|
52
54
|
end
|
|
53
55
|
|
|
54
56
|
def spatial?
|
|
57
|
+
# Guard against nil sql_type_metadata during type registration
|
|
58
|
+
return false unless sql_type_metadata&.sql_type
|
|
59
|
+
|
|
55
60
|
TrilogisAdapter::SPATIAL_COLUMN_TYPES.include?(sql_type_metadata.sql_type.downcase)
|
|
56
61
|
end
|
|
57
62
|
|
|
@@ -244,8 +244,18 @@ module ActiveRecord
|
|
|
244
244
|
end
|
|
245
245
|
|
|
246
246
|
def spatial_factory
|
|
247
|
-
|
|
247
|
+
# Rails 8.1 freezes type objects for Ractor compatibility
|
|
248
|
+
# If frozen, create factory without caching to avoid FrozenError
|
|
249
|
+
if frozen?
|
|
250
|
+
return RGeo::ActiveRecord::SpatialFactoryStore.instance.factory(
|
|
251
|
+
geo_type: @geo_type,
|
|
252
|
+
sql_type: @sql_type,
|
|
253
|
+
srid: @srid
|
|
254
|
+
)
|
|
255
|
+
end
|
|
248
256
|
|
|
257
|
+
# For non-frozen objects, use instance variable caching
|
|
258
|
+
@spatial_factories ||= {}
|
|
249
259
|
@spatial_factories[@srid] ||= RGeo::ActiveRecord::SpatialFactoryStore.instance.factory(
|
|
250
260
|
geo_type: @geo_type,
|
|
251
261
|
sql_type: @sql_type,
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activerecord-trilogis-adapter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.
|
|
4
|
+
version: 8.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ether Moon
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '8.
|
|
18
|
+
version: '8.1'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '8.
|
|
25
|
+
version: '8.1'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: rgeo
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -43,14 +43,14 @@ dependencies:
|
|
|
43
43
|
requirements:
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '8.
|
|
46
|
+
version: '8.1'
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '8.
|
|
53
|
+
version: '8.1'
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: minitest
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -179,7 +179,7 @@ dependencies:
|
|
|
179
179
|
version: '2.9'
|
|
180
180
|
description: ActiveRecord connection adapter for MySQL. It extends the Rails built-in
|
|
181
181
|
Trilogy adapter and adds spatial extensions support via RGeo. Compatible with Rails
|
|
182
|
-
8.
|
|
182
|
+
8.1+ native Trilogy adapter. Requires Ruby 3.2+ and Rails 8.1+.
|
|
183
183
|
email: chipseru@gmail.com
|
|
184
184
|
executables: []
|
|
185
185
|
extensions: []
|