activerecord-cockroachdb-adapter 6.1.9 → 6.1.11

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: a8b028b8755fedebaa4aff7f1f98218d553726364df8fcc24647c3bfd7c80e2d
4
- data.tar.gz: 3f7268dccaf636eb1532697dd525a39930a829eba290f06d7446cc24547e0ea1
3
+ metadata.gz: 29c3318f817a9fd47781d39fe3c9ae0271341a3c6d19398e4f284de85417c024
4
+ data.tar.gz: ceaef29be16168e8440a8beacae0b1c846d29093ea348c993d8ec25bebd43584
5
5
  SHA512:
6
- metadata.gz: cea6678432382da1af4de2fb0216d820bde0be2c254d564fa931fc34683898ec72faf507263bed58187e2f582f55b1c590d1ba8b3fd8487be69518578903821f
7
- data.tar.gz: a3e7d5dbc70abfeac236084dbcc7e60530d10413fbee0f8d6c08668c11d7ab3394e882b6a5a4b660520a1c456de09585128f66de92708ab2ad314f9ca3c66498
6
+ metadata.gz: 67952a7628ffc8031dc13d7ad9590a11998f254445f490f4cfa21ab23135d6a7882ed3e9eb36514da9e6d6f91a4cbc0b2ac1a3a4ee61835f7e50b558bdbe7d9f
7
+ data.tar.gz: ef9ffcd4772e1c2593660c3e8ce55d2c30baaf32601ca945dcaa50cd668d30c197020bd5dc9cbf0ef5f55b0ec2145c89e3aebbc1f64f87cfbf5c295c3149a45b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.1.11 - 2024-06-24
4
+
5
+ - Add support for sql dump in rake tasks.
6
+
7
+ ## 6.1.10 - 2022-05-06
8
+
9
+ - Disable supports_expression_index regardless of CockroachDB version until
10
+ `ON CONFLICT expression` is supported.
11
+
12
+ See https://github.com/cockroachdb/cockroach/issues/67893.
13
+
3
14
  ## 6.1.9 - 2022-04-26
4
15
 
5
16
  - Fix bug where duplicate `rowid` columns would be created when loading
@@ -39,7 +50,7 @@
39
50
 
40
51
  ## 6.1.1 - 2021-05-14
41
52
 
42
- - Fix a bug where starting the driver can result in a NoDatabaseError.
53
+ - Fix a bug where starting the driver can result in a NoDatabaseError.
43
54
 
44
55
  ## 6.1.0 - 2021-04-26
45
56
 
@@ -5,7 +5,43 @@ module ActiveRecord
5
5
  module CockroachDB
6
6
  class DatabaseTasks < ActiveRecord::Tasks::PostgreSQLDatabaseTasks
7
7
  def structure_dump(filename, extra_flags=nil)
8
- raise "db:structure:dump is unimplemented. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/2"
8
+ if extra_flags
9
+ raise "No flag supported yet, please raise an issue if needed. " \
10
+ "https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/new"
11
+ end
12
+
13
+ case ActiveRecord::Base.dump_schemas
14
+ when :all, String
15
+ raise "Custom schemas are not supported in CockroachDB. " \
16
+ "See https://github.com/cockroachdb/cockroach/issues/26443."
17
+ when :schema_search_path
18
+ if configuration_hash[:schema_search_path]
19
+ raise "Custom schemas are not supported in CockroachDB. " \
20
+ "See https://github.com/cockroachdb/cockroach/issues/26443."
21
+ end
22
+ end
23
+
24
+ conn = ActiveRecord::Base.connection
25
+ File.open(filename, "w") do |file|
26
+ %w(SCHEMAS TYPES).each do |object_kind|
27
+ ActiveRecord::Base.connection.execute("SHOW CREATE ALL #{object_kind}").each_row { file.puts _1 }
28
+ end
29
+
30
+ ignore_tables = ActiveRecord::SchemaDumper.ignore_tables.to_set
31
+
32
+ conn.execute("SHOW CREATE ALL TABLES").each_row do |(sql)|
33
+ if sql.start_with?("CREATE")
34
+ table_name = sql[/CREATE TABLE (?:.*?\.)?\"?(.*?)[\" ]/, 1]
35
+ next if ignore_tables.member?(table_name)
36
+ elsif sql.start_with?("ALTER")
37
+ table_name = sql[/ALTER TABLE (?:.*?\.)?\"?(.*?)[\" ]/, 1]
38
+ ref_table_name = sql[/REFERENCES (?:.*?\.)?\"?(.*?)[\" ]/, 1]
39
+ next if ignore_tables.member?(table_name) || ignore_tables.member?(ref_table_name)
40
+ end
41
+
42
+ file.puts sql
43
+ end
44
+ end
9
45
  end
10
46
 
11
47
  def structure_load(filename, extra_flags=nil)
@@ -181,7 +181,10 @@ module ActiveRecord
181
181
  end
182
182
 
183
183
  def supports_expression_index?
184
- @crdb_version >= 2122
184
+ # Expression indexes are partially supported by CockroachDB v21.2,
185
+ # but activerecord requires "ON CONFLICT expression" support.
186
+ # See https://github.com/cockroachdb/cockroach/issues/67893
187
+ false
185
188
  end
186
189
 
187
190
  def supports_datetime_with_precision?
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.9"
4
+ COCKROACH_DB_ADAPTER_VERSION = "6.1.11"
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.9
4
+ version: 6.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cockroach Labs
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-27 00:00:00.000000000 Z
11
+ date: 2024-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
- rubygems_version: 3.1.6
121
+ rubygems_version: 3.4.9
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: CockroachDB adapter for ActiveRecord.