activerecord-mysql2rgeo-adapter 6.1.1 → 7.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_record/connection_adapters/mysql2rgeo/schema_creation.rb +2 -25
- data/lib/active_record/connection_adapters/mysql2rgeo/schema_statements.rb +0 -36
- data/lib/active_record/connection_adapters/mysql2rgeo/version.rb +1 -1
- data/lib/active_record/connection_adapters/mysql2rgeo_adapter.rb +49 -0
- data/lib/active_record/type/spatial.rb +3 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8477b01680100a780afd5d1a41bbb7124e4e9442b7aa026a29741ec7fe729e42
|
4
|
+
data.tar.gz: 7e680ac1a09feb227b8b5111c7de278509982ea713f8146f56a55d43c212bcad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1060dd9a7840478e5d40aafc15c4fcbb51128d8e9d2455f66ddb1b53d81747284a697a014ecfefa8da661c61e30cd5af51a3d32804b6545472f90cc6552e008b
|
7
|
+
data.tar.gz: bf5144c40e65da867e7abd9a67370af09e78f2cf0bb25328651c5b3a977161d35495d70ef80a3ac40f3a946b3b3933679d95afe76533720690022241ef9d19be
|
@@ -7,36 +7,13 @@ module ActiveRecord
|
|
7
7
|
private
|
8
8
|
|
9
9
|
def add_column_options!(sql, options)
|
10
|
-
# By default, TIMESTAMP columns are NOT NULL, cannot contain NULL values,
|
11
|
-
# and assigning NULL assigns the current timestamp. To permit a TIMESTAMP
|
12
|
-
# column to contain NULL, explicitly declare it with the NULL attribute.
|
13
|
-
# See https://dev.mysql.com/doc/refman/en/timestamp-initialization.html
|
14
|
-
if /\Atimestamp\b/.match?(options[:column].sql_type) && !options[:primary_key]
|
15
|
-
sql << " NULL" unless options[:null] == false || options_include_default?(options)
|
16
|
-
end
|
17
|
-
|
18
10
|
if options[:srid]
|
19
11
|
sql << " /*!80003 SRID #{options[:srid]} */"
|
20
12
|
end
|
21
13
|
|
22
|
-
|
23
|
-
sql << " CHARACTER SET #{charset}"
|
24
|
-
end
|
25
|
-
|
26
|
-
if collation = options[:collation]
|
27
|
-
sql << " COLLATE #{collation}"
|
28
|
-
end
|
29
|
-
|
30
|
-
if as = options[:as]
|
31
|
-
sql << " AS (#{as})"
|
32
|
-
if options[:stored]
|
33
|
-
sql << (mariadb? ? " PERSISTENT" : " STORED")
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
add_sql_comment!(super, options[:comment])
|
14
|
+
super
|
38
15
|
end
|
39
16
|
end
|
40
17
|
end
|
41
18
|
end
|
42
|
-
end
|
19
|
+
end
|
@@ -26,42 +26,6 @@ module ActiveRecord
|
|
26
26
|
super
|
27
27
|
end
|
28
28
|
|
29
|
-
# override
|
30
|
-
def native_database_types
|
31
|
-
# Add spatial types
|
32
|
-
# Reference: https://dev.mysql.com/doc/refman/5.6/en/spatial-type-overview.html
|
33
|
-
super.merge(
|
34
|
-
geometry: { name: "geometry" },
|
35
|
-
geometrycollection: { name: "geometrycollection" },
|
36
|
-
linestring: { name: "linestring" },
|
37
|
-
multi_line_string: { name: "multilinestring" },
|
38
|
-
multi_point: { name: "multipoint" },
|
39
|
-
multi_polygon: { name: "multipolygon" },
|
40
|
-
spatial: { name: "geometry" },
|
41
|
-
point: { name: "point" },
|
42
|
-
polygon: { name: "polygon" }
|
43
|
-
)
|
44
|
-
end
|
45
|
-
|
46
|
-
def initialize_type_map(m = type_map)
|
47
|
-
super
|
48
|
-
|
49
|
-
%w[
|
50
|
-
geometry
|
51
|
-
geometrycollection
|
52
|
-
point
|
53
|
-
linestring
|
54
|
-
polygon
|
55
|
-
multipoint
|
56
|
-
multilinestring
|
57
|
-
multipolygon
|
58
|
-
].each do |geo_type|
|
59
|
-
m.register_type(geo_type) do |sql_type|
|
60
|
-
Type::Spatial.new(sql_type)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
29
|
private
|
66
30
|
|
67
31
|
# override
|
@@ -80,6 +80,50 @@ module ActiveRecord
|
|
80
80
|
DEFAULT_SRID
|
81
81
|
end
|
82
82
|
|
83
|
+
def native_database_types
|
84
|
+
# Add spatial types
|
85
|
+
# Reference: https://dev.mysql.com/doc/refman/5.6/en/spatial-type-overview.html
|
86
|
+
super.merge(
|
87
|
+
geometry: { name: "geometry" },
|
88
|
+
geometrycollection: { name: "geometrycollection" },
|
89
|
+
linestring: { name: "linestring" },
|
90
|
+
multi_line_string: { name: "multilinestring" },
|
91
|
+
multi_point: { name: "multipoint" },
|
92
|
+
multi_polygon: { name: "multipolygon" },
|
93
|
+
spatial: { name: "geometry" },
|
94
|
+
point: { name: "point" },
|
95
|
+
polygon: { name: "polygon" }
|
96
|
+
)
|
97
|
+
end
|
98
|
+
|
99
|
+
class << self
|
100
|
+
|
101
|
+
private
|
102
|
+
def initialize_type_map(m)
|
103
|
+
super
|
104
|
+
|
105
|
+
%w[
|
106
|
+
geometry
|
107
|
+
geometrycollection
|
108
|
+
point
|
109
|
+
linestring
|
110
|
+
polygon
|
111
|
+
multipoint
|
112
|
+
multilinestring
|
113
|
+
multipolygon
|
114
|
+
].each do |geo_type|
|
115
|
+
m.register_type(geo_type) do |sql_type|
|
116
|
+
Type::Spatial.new(sql_type.to_s)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
TYPE_MAP = Type::TypeMap.new.tap { |m| initialize_type_map(m) }
|
123
|
+
TYPE_MAP_WITH_BOOLEAN = Type::TypeMap.new(TYPE_MAP).tap do |m|
|
124
|
+
m.register_type %r(^tinyint\(1\))i, Type::Boolean.new
|
125
|
+
end
|
126
|
+
|
83
127
|
def supports_spatial?
|
84
128
|
!mariadb? && version >= "5.7.6"
|
85
129
|
end
|
@@ -92,6 +136,11 @@ module ActiveRecord
|
|
92
136
|
super
|
93
137
|
end
|
94
138
|
end
|
139
|
+
|
140
|
+
private
|
141
|
+
def type_map
|
142
|
+
emulate_booleans ? TYPE_MAP_WITH_BOOLEAN : TYPE_MAP
|
143
|
+
end
|
95
144
|
end
|
96
145
|
end
|
97
146
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-mysql2rgeo-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yongdae Hwang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 7.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 7.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rgeo-activerecord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '2.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '2.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: appraisal
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
127
|
requirements:
|
128
128
|
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: 2.
|
130
|
+
version: 2.7.0
|
131
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
132
|
requirements:
|
133
133
|
- - ">="
|