activerecord-trilogis-adapter 8.1.0 → 8.1.2
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_creation.rb +5 -0
- data/lib/active_record/connection_adapters/trilogis/schema_statements.rb +9 -5
- data/lib/active_record/connection_adapters/trilogis/spatial_column.rb +20 -0
- data/lib/active_record/connection_adapters/trilogis/version.rb +1 -1
- 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: 419ed32019d92d694deee4b70c9d9386ee3ee387eb762483f5c8151a9163e19d
|
|
4
|
+
data.tar.gz: 92fab6a229e669c66bddd378e44eaf75c3ad000147402d29c34b6e3121a7fc5c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 63df2f8342fd89f78fd7549425840be321c7661d0faad8404e9d16bf254bdc7ac56078abb5b3499db6bf57862590be02b512113a3e007ccd03dd58558bce1df0
|
|
7
|
+
data.tar.gz: bb241b59d0c4cbb8f06a019153744d48000db40d46e6df2bae925b22d54257599065acc1efbc2be498cb0f23c2140eb5a39a362fad070f20b6082ba010fa0d2a
|
|
@@ -12,6 +12,11 @@ module ActiveRecord
|
|
|
12
12
|
if options[:srid]
|
|
13
13
|
sql_result = "#{sql} /*!80003 SRID #{options[:srid]} */"
|
|
14
14
|
sql.replace(sql_result)
|
|
15
|
+
|
|
16
|
+
# MySQL does not support DEFAULT values for spatial columns
|
|
17
|
+
# Remove :default option before calling super to prevent SQL errors
|
|
18
|
+
options = options.dup
|
|
19
|
+
options.delete(:default)
|
|
15
20
|
end
|
|
16
21
|
|
|
17
22
|
super
|
|
@@ -87,8 +87,9 @@ module ActiveRecord
|
|
|
87
87
|
# Add NULL constraint
|
|
88
88
|
sql_parts << " NOT NULL" if options[:null] == false
|
|
89
89
|
|
|
90
|
-
#
|
|
91
|
-
|
|
90
|
+
# MySQL does not support DEFAULT values for spatial/geometry columns
|
|
91
|
+
# Silently ignore :default option to prevent SQL syntax errors
|
|
92
|
+
# Users should handle defaults at application level instead
|
|
92
93
|
|
|
93
94
|
execute sql_parts.join
|
|
94
95
|
|
|
@@ -174,10 +175,10 @@ module ActiveRecord
|
|
|
174
175
|
SpatialColumn.new(
|
|
175
176
|
field_name,
|
|
176
177
|
cast_type,
|
|
177
|
-
|
|
178
|
+
nil, # MySQL spatial columns cannot have DEFAULT values
|
|
178
179
|
type_metadata,
|
|
179
180
|
extract_field_value(field, :Null, :null) == "YES",
|
|
180
|
-
|
|
181
|
+
nil, # MySQL spatial columns cannot have DEFAULT functions
|
|
181
182
|
collation: extract_field_value(field, :Collation, :collation),
|
|
182
183
|
comment: extract_field_value(field, :Comment, :comment).presence,
|
|
183
184
|
spatial_info: spatial_info
|
|
@@ -197,7 +198,10 @@ module ActiveRecord
|
|
|
197
198
|
column_sql_parts << " SRID #{o.options[:srid]}" if o.options[:srid] && o.options[:srid] != 0
|
|
198
199
|
|
|
199
200
|
column_sql_parts << " NOT NULL" unless o.null
|
|
200
|
-
|
|
201
|
+
|
|
202
|
+
# MySQL does not support DEFAULT values for spatial/geometry columns
|
|
203
|
+
# Silently ignore default to prevent SQL syntax errors
|
|
204
|
+
|
|
201
205
|
column_sql_parts.join
|
|
202
206
|
else
|
|
203
207
|
super
|
|
@@ -88,6 +88,26 @@ module ActiveRecord
|
|
|
88
88
|
# Type information is in the type() method
|
|
89
89
|
{ srid: @srid }.compact
|
|
90
90
|
end
|
|
91
|
+
|
|
92
|
+
# Override default to always return nil for spatial columns
|
|
93
|
+
# MySQL does not support DEFAULT values for spatial/geometry columns
|
|
94
|
+
def default
|
|
95
|
+
return super unless spatial?
|
|
96
|
+
|
|
97
|
+
# Always return nil for spatial columns to prevent schema dumper
|
|
98
|
+
# from generating invalid DEFAULT clauses
|
|
99
|
+
nil
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Override default_function to always return nil for spatial columns
|
|
103
|
+
# MySQL does not support DEFAULT values for spatial/geometry columns
|
|
104
|
+
def default_function
|
|
105
|
+
return super unless spatial?
|
|
106
|
+
|
|
107
|
+
# Always return nil for spatial columns to prevent schema dumper
|
|
108
|
+
# from generating invalid DEFAULT clauses
|
|
109
|
+
nil
|
|
110
|
+
end
|
|
91
111
|
end
|
|
92
112
|
end
|
|
93
113
|
end
|
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.1.
|
|
4
|
+
version: 8.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ether Moon
|
|
@@ -215,14 +215,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
215
215
|
version: 3.2.0
|
|
216
216
|
- - "<"
|
|
217
217
|
- !ruby/object:Gem::Version
|
|
218
|
-
version: '
|
|
218
|
+
version: '5.0'
|
|
219
219
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
220
|
requirements:
|
|
221
221
|
- - ">="
|
|
222
222
|
- !ruby/object:Gem::Version
|
|
223
223
|
version: '0'
|
|
224
224
|
requirements: []
|
|
225
|
-
rubygems_version:
|
|
225
|
+
rubygems_version: 4.0.3
|
|
226
226
|
specification_version: 4
|
|
227
227
|
summary: ActiveRecord adapter for MySQL with spatial extensions, built on Trilogy.
|
|
228
228
|
test_files: []
|