pg_online_schema_change 0.9.2 → 0.9.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: 2900c279c3ecb38f1deb228d82cb9c476f9aac331d669fea97c10ddd6eb41a94
4
- data.tar.gz: 84f9a35eed1d5cde22924297e83d9539a218a964b76901005cdd6f389ee3c423
3
+ metadata.gz: d6adb7f29ff0c9da8f24fbf500607c09ade1dc317cfdf7b9f47adaea67b248e8
4
+ data.tar.gz: 12505a58953eab715727bc0aace93627ada9219b400e3d39136876eb2e61c4f6
5
5
  SHA512:
6
- metadata.gz: 1395602fbea53d0d0d768fefed3d94f5cab39fae007ccd0c008f8a5818bf9de3b9f179a61b6cb91dbae288fec6cbd99e5bb6b494f1b38c0affe8c5c57d351b15
7
- data.tar.gz: 5c0c2a4b305e147932a4fe8a62c9897238914343c95a39114cb5b8b05154eebee35c1e7fa164b592c7938c253c6b9ca8c3f943063b4b6c4b30618f31fefd3ae4
6
+ metadata.gz: '085f9daeb48c1a4ca457b83c6b83a0c18ca03cd316afbdc9db66bfd071a0766327406607c0ce8ab8be2dc2cf2b84d9e815b40e73d67b492397b64496da86333d'
7
+ data.tar.gz: 53da477897552e78dbf4fb9f10742d8f8d7f1a9a9bbd498128a61b7df6f38d0376b1560b823fab433841a1d67b705935c77c447efb760c128cf4245a20fb29a8
data/.rubocop.yml CHANGED
@@ -215,7 +215,7 @@ RSpec/DescribeClass:
215
215
  RSpec/DescribedClass:
216
216
  Enabled: false
217
217
 
218
- RSpec/FilePath:
218
+ RSpec/SpecFilePathFormat:
219
219
  Enabled: false
220
220
 
221
221
  RSpec/IdenticalEqualityAssertion:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.9.2] - 2023-07-03
2
+
3
+ - Dependency updates
4
+ - Create shadow and audit with auatovacuum default turned off. Should avoid lock queues when disabling vacuum on audit table. #97
5
+ ## [0.9.1] - 2023-06-24
6
+
7
+ - Dependency updates and refresh docker release process with multi-platform build
8
+
1
9
  ## [0.9.0] - 2023-05-22
2
10
 
3
11
  - Fix typo in README.md https://github.com/shayonj/pg-osc/pull/87
data/Gemfile.lock CHANGED
@@ -11,10 +11,11 @@ GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
13
  ast (2.4.2)
14
+ base64 (0.1.1)
14
15
  coderay (1.1.3)
15
16
  diff-lcs (1.5.0)
16
- google-protobuf (3.23.3-arm64-darwin)
17
- google-protobuf (3.23.3-x86_64-linux)
17
+ google-protobuf (3.23.4-arm64-darwin)
18
+ google-protobuf (3.23.4-x86_64-linux)
18
19
  haml (6.1.1)
19
20
  temple (>= 0.8.2)
20
21
  thor
@@ -29,8 +30,8 @@ GEM
29
30
  parser (3.2.2.3)
30
31
  ast (~> 2.4.1)
31
32
  racc
32
- pg (1.5.3)
33
- pg_query (4.2.1)
33
+ pg (1.5.4)
34
+ pg_query (4.2.3)
34
35
  google-protobuf (>= 3.22.3)
35
36
  prettier_print (1.2.1)
36
37
  pry (0.14.2)
@@ -41,7 +42,7 @@ GEM
41
42
  rake (13.0.6)
42
43
  rbs (3.1.0)
43
44
  regexp_parser (2.8.1)
44
- rexml (3.2.5)
45
+ rexml (3.2.6)
45
46
  rspec (3.12.0)
46
47
  rspec-core (~> 3.12.0)
47
48
  rspec-expectations (~> 3.12.0)
@@ -55,7 +56,8 @@ GEM
55
56
  diff-lcs (>= 1.2.0, < 2.0)
56
57
  rspec-support (~> 3.12.0)
57
58
  rspec-support (3.12.0)
58
- rubocop (1.54.0)
59
+ rubocop (1.56.3)
60
+ base64 (~> 0.1.1)
59
61
  json (~> 2.3)
60
62
  language_server-protocol (>= 3.17.0)
61
63
  parallel (~> 1.10)
@@ -63,23 +65,23 @@ GEM
63
65
  rainbow (>= 2.2.2, < 4.0)
64
66
  regexp_parser (>= 1.8, < 3.0)
65
67
  rexml (>= 3.2.5, < 4.0)
66
- rubocop-ast (>= 1.28.0, < 2.0)
68
+ rubocop-ast (>= 1.28.1, < 2.0)
67
69
  ruby-progressbar (~> 1.7)
68
70
  unicode-display_width (>= 2.4.0, < 3.0)
69
71
  rubocop-ast (1.29.0)
70
72
  parser (>= 3.2.1.0)
71
73
  rubocop-capybara (2.18.0)
72
74
  rubocop (~> 1.41)
73
- rubocop-factory_bot (2.22.0)
75
+ rubocop-factory_bot (2.23.1)
74
76
  rubocop (~> 1.33)
75
77
  rubocop-packaging (0.5.2)
76
78
  rubocop (>= 1.33, < 2.0)
77
- rubocop-performance (1.18.0)
79
+ rubocop-performance (1.19.0)
78
80
  rubocop (>= 1.7.0, < 2.0)
79
81
  rubocop-ast (>= 0.4.0)
80
82
  rubocop-rake (0.6.0)
81
83
  rubocop (~> 1.0)
82
- rubocop-rspec (2.22.0)
84
+ rubocop-rspec (2.24.0)
83
85
  rubocop (~> 1.33)
84
86
  rubocop-capybara (~> 2.17)
85
87
  rubocop-factory_bot (~> 2.22)
@@ -105,6 +105,7 @@ module PgOnlineSchemaChange
105
105
  PgOnlineSchemaChange::Orchestrate.run!(client_options)
106
106
  end
107
107
 
108
+ map ['--version', '-v'] => :version
108
109
  desc "--version, -v", "print the version"
109
110
 
110
111
  def version
@@ -35,7 +35,6 @@ module PgOnlineSchemaChange
35
35
  Store.set(:operation_type_column, "operation_type_#{pgosc_identifier}")
36
36
  Store.set(:trigger_time_column, "trigger_time_#{pgosc_identifier}")
37
37
  Store.set(:audit_table_pk, "at_#{pgosc_identifier}_id")
38
- Store.set(:audit_table_pk_sequence, "#{audit_table}_#{audit_table_pk}_seq")
39
38
  Store.set(:shadow_table, "pgosc_st_#{client.table.downcase}_#{pgosc_identifier}")
40
39
  Store.set(:primary_table_storage_parameters, Query.storage_parameters_for(client, client.table_name, true) || "")
41
40
 
@@ -109,6 +108,8 @@ module PgOnlineSchemaChange
109
108
  SQL
110
109
 
111
110
  Query.run(client.connection, sql)
111
+
112
+ Store.set(:audit_table_pk_sequence, Query.get_sequence_name(client, audit_table, audit_table_pk))
112
113
  end
113
114
 
114
115
  def setup_trigger!
@@ -134,6 +134,18 @@ module PgOnlineSchemaChange
134
134
  indexes
135
135
  end
136
136
 
137
+ # fetches the sequence name of a table and column combination
138
+ def get_sequence_name(client, table, column)
139
+ query = <<~SQL
140
+ SELECT pg_get_serial_sequence('#{table}', '#{column}');
141
+ SQL
142
+
143
+ run(client.connection, query) { |result| result.map { |row|
144
+ row["pg_get_serial_sequence"]
145
+ }
146
+ }.first
147
+ end
148
+
137
149
  def get_triggers_for(client, table)
138
150
  query = <<~SQL
139
151
  SELECT pg_get_triggerdef(oid) as tdef FROM pg_trigger
@@ -302,7 +314,7 @@ module PgOnlineSchemaChange
302
314
 
303
315
  def view_definitions_for(client, table)
304
316
  query = <<~SQL
305
- SELECT DISTINCT dependent_view.relname as view_name, pg_get_viewdef(dependent_view.relname::regclass) as view_definition
317
+ SELECT DISTINCT dependent_view.relname as view_name, pg_get_viewdef(format('%I.%I', '#{client.schema}', dependent_view.relname)::regclass) as view_definition
306
318
  FROM pg_depend
307
319
  JOIN pg_rewrite ON pg_depend.objid = pg_rewrite.oid
308
320
  JOIN pg_class as dependent_view ON pg_rewrite.ev_class = dependent_view.oid
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgOnlineSchemaChange
4
- VERSION = "0.9.2"
4
+ VERSION = "0.9.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_online_schema_change
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shayon Mukherjee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-04 00:00:00.000000000 Z
11
+ date: 2023-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ougai