activerecord-cockroachdb-adapter 6.1.0 → 6.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e12a061e79d389fd1c698456bf368bb8a2971d3c8e1580242aadb669bfa30809
|
4
|
+
data.tar.gz: e12b269976f47ff593b3ece0f7848e56b76dda1d6a797dc826c483d301dc3082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52a6c9404a44dac790e2e7c61548d703d53f27c9654d492e9e58ba2b0f20cd7d93f9c92d26391038eccb590695b71c90d15872d44e299fd7a4e6e3f1185a2986
|
7
|
+
data.tar.gz: fff215842d13491523a7001273df0abec8a95b31294c71b6873f1c604e77f3b43d98beac514bca747ef8bd55aec9160e2ff47cfb7181eac1e230a8a9d16ec6a7
|
data/README.md
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
# ActiveRecord CockroachDB Adapter
|
2
2
|
|
3
|
-
CockroachDB adapter for ActiveRecord
|
3
|
+
CockroachDB adapter for ActiveRecord 5 and 6. This is a lightweight extension of the PostgreSQL adapter that establishes compatibility with [CockroachDB](https://github.com/cockroachdb/cockroach).
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
7
|
Add this line to your project's Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem 'activerecord-cockroachdb-adapter', '~>
|
10
|
+
gem 'activerecord-cockroachdb-adapter', '~> 6.1.0'
|
11
11
|
```
|
12
12
|
|
13
|
-
If you're using Rails
|
13
|
+
If you're using Rails 5.2, use the `5.2.x` versions of this gem.
|
14
|
+
|
15
|
+
If you're using Rails 6.0, use the `6.0.x` versions of this gem.
|
14
16
|
|
15
17
|
In `database.yml`, use the following adapter setting:
|
16
18
|
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "activerecord-cockroachdb-adapter"
|
7
|
-
spec.version = "6.1.
|
7
|
+
spec.version = "6.1.1"
|
8
8
|
spec.licenses = ["Apache-2.0"]
|
9
9
|
spec.authors = ["Cockroach Labs"]
|
10
10
|
spec.email = ["cockroach-db@googlegroups.com"]
|
@@ -63,18 +63,23 @@ module ActiveRecord
|
|
63
63
|
adapter = pool_config.db_config.configuration_hash[:adapter]
|
64
64
|
return if disable_telemetry || adapter != "cockroachdb"
|
65
65
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
66
|
+
|
67
|
+
begin
|
68
|
+
with_connection do |conn|
|
69
|
+
if conn.active?
|
70
|
+
begin
|
71
|
+
query = "SELECT crdb_internal.increment_feature_counter('ActiveRecord %d.%d')"
|
72
|
+
conn.execute(query % [ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR])
|
73
|
+
rescue ActiveRecord::StatementInvalid
|
74
|
+
# The increment_feature_counter built-in is not supported on this
|
75
|
+
# CockroachDB version. Ignore.
|
76
|
+
rescue StandardError => e
|
77
|
+
conn.logger.warn "Unexpected error when incrementing feature counter: #{e}"
|
78
|
+
end
|
76
79
|
end
|
77
80
|
end
|
81
|
+
rescue ActiveRecord::NoDatabaseError
|
82
|
+
# Prevent failures on db creation and parallel testing.
|
78
83
|
end
|
79
84
|
end
|
80
85
|
end
|
@@ -98,7 +103,7 @@ module ActiveRecord
|
|
98
103
|
st_polygon: {},
|
99
104
|
}
|
100
105
|
|
101
|
-
# http://postgis.17.x6.nabble.com/Default-SRID-td5001115.html
|
106
|
+
# http://postgis.17.x6.nabble.com/Default-SRID-td5001115.html
|
102
107
|
DEFAULT_SRID = 0
|
103
108
|
|
104
109
|
include CockroachDB::SchemaStatements
|
@@ -272,12 +277,9 @@ module ActiveRecord
|
|
272
277
|
precision = extract_precision(sql_type)
|
273
278
|
scale = extract_scale(sql_type)
|
274
279
|
|
275
|
-
# TODO(#178) this should never use DecimalWithoutScale since scale
|
276
|
-
# is assumed to be 0 if it is not explicitly defined.
|
277
|
-
#
|
278
280
|
# If fmod is -1, that means that precision is defined but not
|
279
281
|
# scale, or neither is defined.
|
280
|
-
if fmod && fmod == -1
|
282
|
+
if fmod && fmod == -1 && !precision.nil?
|
281
283
|
# Below comment is from ActiveRecord
|
282
284
|
# FIXME: Remove this class, and the second argument to
|
283
285
|
# lookups on PG
|
@@ -390,7 +392,7 @@ module ActiveRecord
|
|
390
392
|
# In general, it is hard to parse that, but it is easy to handle the common
|
391
393
|
# case of an empty array.
|
392
394
|
def extract_empty_array_from_default(default)
|
393
|
-
return unless supports_string_to_array_coercion?
|
395
|
+
return unless supports_string_to_array_coercion?
|
394
396
|
return unless default =~ /\AARRAY\[\]\z/
|
395
397
|
return "{}"
|
396
398
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-cockroachdb-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.
|
4
|
+
version: 6.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cockroach Labs
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -100,7 +100,7 @@ licenses:
|
|
100
100
|
- Apache-2.0
|
101
101
|
metadata:
|
102
102
|
allowed_push_host: https://rubygems.org
|
103
|
-
post_install_message:
|
103
|
+
post_install_message:
|
104
104
|
rdoc_options: []
|
105
105
|
require_paths:
|
106
106
|
- lib
|
@@ -115,8 +115,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
|
-
rubygems_version: 3.
|
119
|
-
signing_key:
|
118
|
+
rubygems_version: 3.0.3
|
119
|
+
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: CockroachDB adapter for ActiveRecord.
|
122
122
|
test_files: []
|