activerecord-mysql2rgeo-adapter 6.1.1 → 7.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc08589944b261d0dca6908f375c8453eae76a29ff3da7a6c76f264fac0400dd
4
- data.tar.gz: a3682118ef63d2605688f0f2c81713af2c58987a42f40425baff6f58326bf059
3
+ metadata.gz: 8477b01680100a780afd5d1a41bbb7124e4e9442b7aa026a29741ec7fe729e42
4
+ data.tar.gz: 7e680ac1a09feb227b8b5111c7de278509982ea713f8146f56a55d43c212bcad
5
5
  SHA512:
6
- metadata.gz: 6a791e518607f77b3fa3affcca3402498d669d8011613c33e811db57278096382b87897a1477b8b18a66c4175ecd419ed161dd57a050b837b6e160943108158a
7
- data.tar.gz: 03d6461ef1db07a0deedba7d5843bf6e9a4a00927de6f5e3b6c1ecf8834e1c95494d6ff03b56d0b08aeab675a4e39cea1e7623808507e5b4c62270f3e540a82f
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
- if charset = options[:charset]
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
@@ -3,7 +3,7 @@
3
3
  module ActiveRecord
4
4
  module ConnectionAdapters
5
5
  module Mysql2Rgeo
6
- VERSION = "6.1.1"
6
+ VERSION = "7.0.1"
7
7
  end
8
8
  end
9
9
  end
@@ -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
@@ -40,7 +40,9 @@ module ActiveRecord
40
40
  end
41
41
 
42
42
  def spatial_factory
43
- @spatial_factory ||=
43
+ @spatial_factories ||= {}
44
+
45
+ @spatial_factories[@srid] ||=
44
46
  RGeo::ActiveRecord::SpatialFactoryStore.instance.factory(
45
47
  geo_type: @geo_type,
46
48
  sql_type: @sql_type,
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: 6.1.1
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: 2022-06-13 00:00:00.000000000 Z
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: '6.1'
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: '6.1'
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: '1.1'
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: '1.1'
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.5.0
130
+ version: 2.7.0
131
131
  required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  requirements:
133
133
  - - ">="