activerecord-trilogis-adapter 8.0.1 → 8.0.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 +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c62868490c8dbbca1486797b7f451fe16da47e250d97d9578bc28bd405f88979
|
|
4
|
+
data.tar.gz: 53635558156147dadcf07913b4faeec937b0c8d1fd09548a82ac8168d10c3c45
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 12824854fd79269b2f00231712267db378e642579ea462a2aee7c1e377961ee65a0f03d2d47227484b9bfaa1800549fa2b207c7e8c5e29d9b1059b7deafed4bd
|
|
7
|
+
data.tar.gz: 1bb9c83957682886cb09eb343fe82ef2e9e9c2a4eb6998f01ecfe0d5c3c8a52659bfccd7344433260e1de3c66d15f8579ed2132286471fe9b9f235b042ef2b1e
|
|
@@ -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
|
|
|
@@ -165,10 +166,10 @@ module ActiveRecord
|
|
|
165
166
|
|
|
166
167
|
SpatialColumn.new(
|
|
167
168
|
field_name,
|
|
168
|
-
|
|
169
|
+
nil, # MySQL spatial columns cannot have DEFAULT values
|
|
169
170
|
type_metadata,
|
|
170
171
|
extract_field_value(field, :Null, :null) == "YES",
|
|
171
|
-
|
|
172
|
+
nil, # MySQL spatial columns cannot have DEFAULT functions
|
|
172
173
|
collation: extract_field_value(field, :Collation, :collation),
|
|
173
174
|
comment: extract_field_value(field, :Comment, :comment).presence,
|
|
174
175
|
spatial_info: spatial_info
|
|
@@ -188,7 +189,10 @@ module ActiveRecord
|
|
|
188
189
|
column_sql_parts << " SRID #{o.options[:srid]}" if o.options[:srid] && o.options[:srid] != 0
|
|
189
190
|
|
|
190
191
|
column_sql_parts << " NOT NULL" unless o.null
|
|
191
|
-
|
|
192
|
+
|
|
193
|
+
# MySQL does not support DEFAULT values for spatial/geometry columns
|
|
194
|
+
# Silently ignore default to prevent SQL syntax errors
|
|
195
|
+
|
|
192
196
|
column_sql_parts.join
|
|
193
197
|
else
|
|
194
198
|
super
|
|
@@ -83,6 +83,26 @@ module ActiveRecord
|
|
|
83
83
|
# Type information is in the type() method
|
|
84
84
|
{ srid: @srid }.compact
|
|
85
85
|
end
|
|
86
|
+
|
|
87
|
+
# Override default to always return nil for spatial columns
|
|
88
|
+
# MySQL does not support DEFAULT values for spatial/geometry columns
|
|
89
|
+
def default
|
|
90
|
+
return super unless spatial?
|
|
91
|
+
|
|
92
|
+
# Always return nil for spatial columns to prevent schema dumper
|
|
93
|
+
# from generating invalid DEFAULT clauses
|
|
94
|
+
nil
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Override default_function to always return nil for spatial columns
|
|
98
|
+
# MySQL does not support DEFAULT values for spatial/geometry columns
|
|
99
|
+
def default_function
|
|
100
|
+
return super unless spatial?
|
|
101
|
+
|
|
102
|
+
# Always return nil for spatial columns to prevent schema dumper
|
|
103
|
+
# from generating invalid DEFAULT clauses
|
|
104
|
+
nil
|
|
105
|
+
end
|
|
86
106
|
end
|
|
87
107
|
end
|
|
88
108
|
end
|