activerecord-cockroachdb-adapter 6.1.4 → 6.1.5

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: ee61867492cc8b0c28f58b9090625a08914e610e6a1732924a2b4d925a01a714
4
- data.tar.gz: d7ae4281ca3738f92e84df29243c687693cf8aed64ba006d9c44541c25ba2029
3
+ metadata.gz: 91f5211d32cfc503198148dab27748e66dc7fd86bd7d1916ed78a59879cc7235
4
+ data.tar.gz: 69d4191eef0d08f6a472317413eb16abfcdb548e058c6d1074ca34c1a5ad21d4
5
5
  SHA512:
6
- metadata.gz: c61ca3b032274dc8cc5063e55465fdc2b418bbda7c6d8a4093405d61c5c2b49758faaf77f95a76eb0c46101e3ec0a4f9c1442744abe49bcc747a0b86de64bec9
7
- data.tar.gz: f91ea52d72dcef0c50e87186b12f10c7118882e48e10ef667c64e59da159493ea8dd23b5bbb4256c9222d703afaf89d7554831d2ef523096151af9fdf9faaf9f
6
+ metadata.gz: a8702aea7fd32df17b58c68d5a29df99c3514784bb876dc1d49c36b98f824f8200a02e74f4f543ec51aaa1d8ff5da14729e155ee5b1223e0944a5768df309244
7
+ data.tar.gz: 5980c011b221d6b23b96b7f0e4ec0050a991a83235ac975783b67d8543638e1e7b75b47e870ee720c0e4584ec739f312d2946aff8a1580dba46c49a6dab001d9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.1.5 - 2022-02-08
4
+
5
+ - Support `atttypmod` being sent for DECIMAL types.
6
+ This is needed for CockroachDB v22.1.
7
+
3
8
  ## 6.1.4 - 2021-12-09
4
9
 
5
10
  - Add support for CockroachDB v21.2.
@@ -3,7 +3,7 @@
3
3
  set -euox pipefail
4
4
 
5
5
  # Download CockroachDB
6
- VERSION=v21.2.0
6
+ VERSION=v21.2.5
7
7
  wget -qO- https://binaries.cockroachdb.com/cockroach-$VERSION.linux-amd64.tgz | tar xvz
8
8
  readonly COCKROACH=./cockroach-$VERSION.linux-amd64/cockroach
9
9
 
@@ -35,8 +35,28 @@ run_cockroach() {
35
35
  cockroach sql --insecure -e 'CREATE DATABASE activerecord_unittest2;'
36
36
  cockroach sql --insecure -e 'SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;'
37
37
  cockroach sql --insecure -e 'SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;'
38
- cockroach sql --insecure -e "SET CLUSTER SETTING jobs.retention_time = '180s';"
39
- cockroach sql --insecure -e "SET CLUSTER SETTING sql.defaults.experimental_temporary_tables.enabled = 'true'"
38
+
39
+ cockroach sql --insecure -e "ALTER RANGE default CONFIGURE ZONE USING num_replicas = 1, gc.ttlseconds = 30;"
40
+ cockroach sql --insecure -e "ALTER TABLE system.public.jobs CONFIGURE ZONE USING num_replicas = 1, gc.ttlseconds = 30;"
41
+ cockroach sql --insecure -e "ALTER RANGE meta CONFIGURE ZONE USING num_replicas = 1, gc.ttlseconds = 30;"
42
+ cockroach sql --insecure -e "ALTER RANGE system CONFIGURE ZONE USING num_replicas = 1, gc.ttlseconds = 30;"
43
+ cockroach sql --insecure -e "ALTER RANGE liveness CONFIGURE ZONE USING num_replicas = 1, gc.ttlseconds = 30;"
44
+
45
+ cockroach sql --insecure -e "SET CLUSTER SETTING kv.range_merge.queue_interval = '50ms'"
46
+ cockroach sql --insecure -e "SET CLUSTER SETTING kv.raft_log.disable_synchronization_unsafe = 'true'"
47
+ cockroach sql --insecure -e "SET CLUSTER SETTING jobs.registry.interval.cancel = '180s';"
48
+ cockroach sql --insecure -e "SET CLUSTER SETTING jobs.registry.interval.gc = '30s';"
49
+ cockroach sql --insecure -e "SET CLUSTER SETTING jobs.retention_time = '15s';"
50
+ cockroach sql --insecure -e "SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;"
51
+ cockroach sql --insecure -e "SET CLUSTER SETTING kv.range_split.by_load_merge_delay = '5s';"
52
+
53
+ # Enable when we test with v22.1.
54
+ # cockroach sql --insecure -e "SET CLUSTER SETTING sql.catalog.unsafe_skip_system_config_trigger.enabled = true;"
55
+
56
+ # Enable experimental features.
57
+ cockroach sql --insecure -e "SET CLUSTER SETTING sql.defaults.experimental_temporary_tables.enabled = 'true';"
58
+ cockroach sql --insecure -e "SET CLUSTER SETTING sql.defaults.datestyle.enabled = true"
59
+ cockroach sql --insecure -e "SET CLUSTER SETTING sql.defaults.intervalstyle.enabled = true;"
40
60
  }
41
61
 
42
62
  # Install ruby dependencies.
@@ -297,9 +297,19 @@ module ActiveRecord
297
297
  precision = extract_precision(sql_type)
298
298
  scale = extract_scale(sql_type)
299
299
 
300
+
301
+ # The type for the numeric depends on the width of the field,
302
+ # so we'll do something special here.
303
+ #
304
+ # When dealing with decimal columns:
305
+ #
306
+ # places after decimal = fmod - 4 & 0xffff
307
+ # places before decimal = (fmod - 4) >> 16 & 0xffff
308
+ #
309
+ # For older versions of CockroachDB (<v22.1), fmod is -1 for 0 width.
300
310
  # If fmod is -1, that means that precision is defined but not
301
311
  # scale, or neither is defined.
302
- if fmod && fmod == -1 && !precision.nil?
312
+ if fmod && ((fmod == -1 && !precision.nil?) || (fmod - 4 & 0xffff).zero?)
303
313
  # Below comment is from ActiveRecord
304
314
  # FIXME: Remove this class, and the second argument to
305
315
  # lookups on PG
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecord
4
- COCKROACH_DB_ADAPTER_VERSION = "6.1.4"
4
+ COCKROACH_DB_ADAPTER_VERSION = "6.1.5"
5
5
  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
4
+ version: 6.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cockroach Labs
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-13 00:00:00.000000000 Z
11
+ date: 2022-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord