activerecord-trilogis-adapter 8.1.0 → 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_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 +1 -1
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
|
|
@@ -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
|