activerecord-cockroachdb-adapter 6.1.10 → 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: 72a654c4b06b42fbaae48bc9610420b2103f38b72d4170b7ae59983860d6e9d6
4
- data.tar.gz: fb400dec89ffb39d202a081ff09a34330a498e3e9ce4363433d55de255a0288a
3
+ metadata.gz: 29c3318f817a9fd47781d39fe3c9ae0271341a3c6d19398e4f284de85417c024
4
+ data.tar.gz: ceaef29be16168e8440a8beacae0b1c846d29093ea348c993d8ec25bebd43584
5
5
  SHA512:
6
- metadata.gz: f39c8a1fb5da46833e2ebb25a7224fd4c7d6bf1b71649d06550e60bd00e6dc084ef6675d9314995a002a507aa3e382efb7947fdc951221612fbc12b730b95fed
7
- data.tar.gz: b133873824c59d673b9aed7a8cb45933aa7298bf9b5dc533240e9e43e99820ab1abe0be09874a9d0f5b6f7ce599441b7c1e462ecc83754f0de87dab9ca8ce50b
6
+ metadata.gz: 67952a7628ffc8031dc13d7ad9590a11998f254445f490f4cfa21ab23135d6a7882ed3e9eb36514da9e6d6f91a4cbc0b2ac1a3a4ee61835f7e50b558bdbe7d9f
7
+ data.tar.gz: ef9ffcd4772e1c2593660c3e8ce55d2c30baaf32601ca945dcaa50cd668d30c197020bd5dc9cbf0ef5f55b0ec2145c89e3aebbc1f64f87cfbf5c295c3149a45b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.1.11 - 2024-06-24
4
+
5
+ - Add support for sql dump in rake tasks.
6
+
3
7
  ## 6.1.10 - 2022-05-06
4
8
 
5
9
  - Disable supports_expression_index regardless of CockroachDB version until
@@ -46,7 +50,7 @@
46
50
 
47
51
  ## 6.1.1 - 2021-05-14
48
52
 
49
- - 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.
50
54
 
51
55
  ## 6.1.0 - 2021-04-26
52
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)
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.10"
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.10
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-05-12 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.