activerecord-cockroachdb-adapter 6.1.2 → 6.1.3

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: 2d0c9c46ba26129c6660d4c7dcc7fab97e62e6544cf97be3de59876df04b8b49
4
- data.tar.gz: 35952dc2b491d58a1550a8466a0010ce1530465f7e5c17d3cb1863de9d17c304
3
+ metadata.gz: c2f121de56f7c6e8cf67c486533873cf2f081ec2dbe32a6d395849ecd9f7f958
4
+ data.tar.gz: 698808276bece741fc6ec06a69e871ca482e6e69ff3b9e5e95b278619bf4ee02
5
5
  SHA512:
6
- metadata.gz: d1d62e4dc3ef136ebb472b4439f0a500cd64e4c16a1d7f6f1f75d7426ddfd85dc871eb26889b3d617dc80816c3d47533c6d46b9dce6fbc42df8049d76f680cf8
7
- data.tar.gz: 02b1e634681a6e2d25d88d2d78dd0c658bf4125decbce637fa5fa672e3651c099106ee79de86ffa2037ceb3f6fc13e80e8e870b6154e4dbd96f5405b3829003d
6
+ metadata.gz: b2e9255a98a5114f7fd644baf0c2bd3e509f78b2fd73f4c5a85748b9e7ae8a1f212721ffcdf7e04f5bcb841bf752740ed4e0d2c97756f46b65677419fab89e10
7
+ data.tar.gz: b7680180bc3c35f350f92912f447a988582b54f6f90f18414f3b7a730b7b57bfa49c6bfbf2c7668e58a1974f140b02979c9d5cbbae5fa81d0871d39c123b6b39
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.1.3 - 2021-07-28
4
+
5
+ - Santitize the input to the telemetry query that is issued on startup.
6
+
3
7
  ## 6.1.2 - 2021-05-20
4
8
 
5
9
  - Fix a bug where starting the driver can result in a ConnectionNotEstablished error.
@@ -1,10 +1,14 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
 
6
+ require './lib/version.rb'
7
+ version = ActiveRecord::COCKROACH_DB_ADAPTER_VERSION
8
+
5
9
  Gem::Specification.new do |spec|
6
10
  spec.name = "activerecord-cockroachdb-adapter"
7
- spec.version = "6.1.2"
11
+ spec.version = version
8
12
  spec.licenses = ["Apache-2.0"]
9
13
  spec.authors = ["Cockroach Labs"]
10
14
  spec.email = ["cockroach-db@googlegroups.com"]
@@ -3,7 +3,7 @@
3
3
  set -euox pipefail
4
4
 
5
5
  # Download CockroachDB
6
- VERSION=v20.2.3
6
+ VERSION=v21.1.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
 
@@ -36,6 +36,7 @@ run_cockroach() {
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
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'"
39
40
  }
40
41
 
41
42
  # Install ruby dependencies.
@@ -17,6 +17,7 @@ require "active_record/connection_adapters/cockroachdb/oid/type_map_initializer"
17
17
  require "active_record/connection_adapters/cockroachdb/oid/spatial"
18
18
  require "active_record/connection_adapters/cockroachdb/oid/interval"
19
19
  require "active_record/connection_adapters/cockroachdb/arel_tosql"
20
+ require_relative "../../version"
20
21
 
21
22
  # Run to ignore spatial tables that will break schemna dumper.
22
23
  # Defined in ./setup.rb
@@ -63,13 +64,18 @@ module ActiveRecord
63
64
  adapter = pool_config.db_config.configuration_hash[:adapter]
64
65
  return if disable_telemetry || adapter != "cockroachdb"
65
66
 
66
-
67
67
  begin
68
68
  with_connection do |conn|
69
69
  if conn.active?
70
70
  begin
71
- query = "SELECT crdb_internal.increment_feature_counter('ActiveRecord %d.%d')"
72
- conn.execute(query % [ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR])
71
+ ar_version = conn.quote("ActiveRecord %d.%d" % [ActiveRecord::VERSION::MAJOR,
72
+ ActiveRecord::VERSION::MINOR])
73
+ ar_query = "SELECT crdb_internal.increment_feature_counter(%s)" % ar_version
74
+ adapter_version = conn.quote("activerecord-cockroachdb-adapter #{ActiveRecord::COCKROACH_DB_ADAPTER_VERSION}")
75
+ adapter_query = "SELECT crdb_internal.increment_feature_counter(%s)" % adapter_version
76
+
77
+ conn.execute(ar_query)
78
+ conn.execute(adapter_query)
73
79
  rescue ActiveRecord::StatementInvalid
74
80
  # The increment_feature_counter built-in is not supported on this
75
81
  # CockroachDB version. Ignore.
@@ -180,12 +186,10 @@ module ActiveRecord
180
186
  end
181
187
 
182
188
  def supports_comments?
183
- # See cockroachdb/cockroach#19472.
184
- false
189
+ @crdb_version >= 201
185
190
  end
186
191
 
187
192
  def supports_comments_in_create?
188
- # See cockroachdb/cockroach#19472.
189
193
  false
190
194
  end
191
195
 
@@ -235,8 +239,10 @@ module ActiveRecord
235
239
  version_num = 192
236
240
  elsif crdb_version_string.include? "v20.1."
237
241
  version_num = 201
238
- else
242
+ elsif crdb_version_string.include? "v20.2."
239
243
  version_num = 202
244
+ else
245
+ version_num = 210
240
246
  end
241
247
  @crdb_version = version_num
242
248
  end
data/lib/version.rb ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveRecord
4
+ COCKROACH_DB_ADAPTER_VERSION = "6.1.3"
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.2
4
+ version: 6.1.3
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-05-19 00:00:00.000000000 Z
11
+ date: 2021-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -95,12 +95,13 @@ files:
95
95
  - lib/active_record/connection_adapters/cockroachdb/type.rb
96
96
  - lib/active_record/connection_adapters/cockroachdb_adapter.rb
97
97
  - lib/activerecord-cockroachdb-adapter.rb
98
+ - lib/version.rb
98
99
  homepage: https://github.com/cockroachdb/activerecord-cockroachdb-adapter
99
100
  licenses:
100
101
  - Apache-2.0
101
102
  metadata:
102
103
  allowed_push_host: https://rubygems.org
103
- post_install_message:
104
+ post_install_message:
104
105
  rdoc_options: []
105
106
  require_paths:
106
107
  - lib
@@ -115,8 +116,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
116
  - !ruby/object:Gem::Version
116
117
  version: '0'
117
118
  requirements: []
118
- rubygems_version: 3.0.3
119
- signing_key:
119
+ rubygems_version: 3.2.15
120
+ signing_key:
120
121
  specification_version: 4
121
122
  summary: CockroachDB adapter for ActiveRecord.
122
123
  test_files: []