pg_online_schema_change 0.9.0 → 0.9.2

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: 3b959611ab7bbaabb457ac51ee7b25c7449962d8a3ff39986251bfaf2c890a4f
4
- data.tar.gz: a8cff6b404a625b2f1e3099d5ccec6d35ad4e0346e0016bc7837dced67664f88
3
+ metadata.gz: 2900c279c3ecb38f1deb228d82cb9c476f9aac331d669fea97c10ddd6eb41a94
4
+ data.tar.gz: 84f9a35eed1d5cde22924297e83d9539a218a964b76901005cdd6f389ee3c423
5
5
  SHA512:
6
- metadata.gz: d4685933d5e8e5d59f6f4301ad36a1fba2002c7f02f851aea36e9f61f8ab435c7f52b26ee475488adfedb5c8ab872d923619de2c7c0a8f907df50be411a5cc97
7
- data.tar.gz: 44071e34f1caf2078f909c64c87250ff723cff53a31b2f049475bbbac79cbf6b8cf1881d1d9bad456da9287824aceb3c74777841f0a0f28cca5f40cae2a5b60f
6
+ metadata.gz: 1395602fbea53d0d0d768fefed3d94f5cab39fae007ccd0c008f8a5818bf9de3b9f179a61b6cb91dbae288fec6cbd99e5bb6b494f1b38c0affe8c5c57d351b15
7
+ data.tar.gz: 5c0c2a4b305e147932a4fe8a62c9897238914343c95a39114cb5b8b05154eebee35c1e7fa164b592c7938c253c6b9ca8c3f943063b4b6c4b30618f31fefd3ae4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [0.9.0] - 2023-05-22
2
+
3
+ - Fix typo in README.md https://github.com/shayonj/pg-osc/pull/87
4
+ - Support for views https://github.com/shayonj/pg-osc/pull/88
5
+
1
6
  ## [0.8.1] - 2023-05-13
2
7
 
3
8
  - Gem path and CI fixes
data/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
1
  FROM ruby:3.0
2
2
 
3
- ARG VERSION=0.2.0
3
+ ARG VERSION
4
4
 
5
- RUN gem install pg_online_schema_change -v $VERSION
5
+ RUN gem install pg_online_schema_change -v $VERSION
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pg_online_schema_change (0.9.0)
4
+ pg_online_schema_change (0.9.2)
5
5
  ougai (~> 2.0.0)
6
- pg (~> 1.3.2)
7
- pg_query (~> 2.1.3)
6
+ pg (>= 1.3.2, < 1.6.0)
7
+ pg_query (>= 2.1.3, < 4.3.0)
8
8
  thor (~> 1.2.1)
9
9
 
10
10
  GEM
@@ -13,30 +13,34 @@ GEM
13
13
  ast (2.4.2)
14
14
  coderay (1.1.3)
15
15
  diff-lcs (1.5.0)
16
- google-protobuf (3.23.0-arm64-darwin)
16
+ google-protobuf (3.23.3-arm64-darwin)
17
+ google-protobuf (3.23.3-x86_64-linux)
17
18
  haml (6.1.1)
18
19
  temple (>= 0.8.2)
19
20
  thor
20
21
  tilt
21
22
  json (2.6.3)
23
+ language_server-protocol (3.17.0.3)
22
24
  method_source (1.0.0)
23
- oj (3.14.3)
25
+ oj (3.15.0)
24
26
  ougai (2.0.0)
25
27
  oj (~> 3.10)
26
28
  parallel (1.23.0)
27
- parser (3.2.2.1)
29
+ parser (3.2.2.3)
28
30
  ast (~> 2.4.1)
29
- pg (1.3.5)
30
- pg_query (2.1.4)
31
- google-protobuf (>= 3.19.2)
31
+ racc
32
+ pg (1.5.3)
33
+ pg_query (4.2.1)
34
+ google-protobuf (>= 3.22.3)
32
35
  prettier_print (1.2.1)
33
36
  pry (0.14.2)
34
37
  coderay (~> 1.1)
35
38
  method_source (~> 1.0)
39
+ racc (1.7.1)
36
40
  rainbow (3.1.1)
37
41
  rake (13.0.6)
38
42
  rbs (3.1.0)
39
- regexp_parser (2.8.0)
43
+ regexp_parser (2.8.1)
40
44
  rexml (3.2.5)
41
45
  rspec (3.12.0)
42
46
  rspec-core (~> 3.12.0)
@@ -51,17 +55,18 @@ GEM
51
55
  diff-lcs (>= 1.2.0, < 2.0)
52
56
  rspec-support (~> 3.12.0)
53
57
  rspec-support (3.12.0)
54
- rubocop (1.51.0)
58
+ rubocop (1.54.0)
55
59
  json (~> 2.3)
60
+ language_server-protocol (>= 3.17.0)
56
61
  parallel (~> 1.10)
57
- parser (>= 3.2.0.0)
62
+ parser (>= 3.2.2.3)
58
63
  rainbow (>= 2.2.2, < 4.0)
59
64
  regexp_parser (>= 1.8, < 3.0)
60
65
  rexml (>= 3.2.5, < 4.0)
61
66
  rubocop-ast (>= 1.28.0, < 2.0)
62
67
  ruby-progressbar (~> 1.7)
63
68
  unicode-display_width (>= 2.4.0, < 3.0)
64
- rubocop-ast (1.28.1)
69
+ rubocop-ast (1.29.0)
65
70
  parser (>= 3.2.1.0)
66
71
  rubocop-capybara (2.18.0)
67
72
  rubocop (~> 1.41)
@@ -69,7 +74,7 @@ GEM
69
74
  rubocop (~> 1.33)
70
75
  rubocop-packaging (0.5.2)
71
76
  rubocop (>= 1.33, < 2.0)
72
- rubocop-performance (1.17.1)
77
+ rubocop-performance (1.18.0)
73
78
  rubocop (>= 1.7.0, < 2.0)
74
79
  rubocop-ast (>= 0.4.0)
75
80
  rubocop-rake (0.6.0)
@@ -45,7 +45,7 @@ FUNC_CREATE_TABLE_ALL = <<~SQL
45
45
  rec record;
46
46
  begin
47
47
  EXECUTE format(
48
- 'CREATE TABLE %s (LIKE %s including all)',
48
+ 'CREATE TABLE %s (LIKE %s including all) WITH (autovacuum_enabled = false)',
49
49
  newsource_table, source_table);
50
50
  END
51
51
  $$;
@@ -37,6 +37,7 @@ module PgOnlineSchemaChange
37
37
  Store.set(:audit_table_pk, "at_#{pgosc_identifier}_id")
38
38
  Store.set(:audit_table_pk_sequence, "#{audit_table}_#{audit_table_pk}_seq")
39
39
  Store.set(:shadow_table, "pgosc_st_#{client.table.downcase}_#{pgosc_identifier}")
40
+ Store.set(:primary_table_storage_parameters, Query.storage_parameters_for(client, client.table_name, true) || "")
40
41
 
41
42
  Store.set(
42
43
  :referential_foreign_key_statements,
@@ -59,7 +60,6 @@ module PgOnlineSchemaChange
59
60
 
60
61
  setup_trigger!
61
62
  setup_shadow_table! # re-uses transaction with serializable
62
- disable_vacuum! # re-uses transaction with serializable
63
63
  run_alter_statement! # re-uses transaction with serializable
64
64
  copy_data! # re-uses transaction with serializable
65
65
  run_analyze!
@@ -105,7 +105,7 @@ module PgOnlineSchemaChange
105
105
  logger.info("Setting up audit table", { audit_table: audit_table })
106
106
 
107
107
  sql = <<~SQL
108
- CREATE TABLE #{audit_table} (#{audit_table_pk} SERIAL PRIMARY KEY, #{operation_type_column} text, #{trigger_time_column} timestamp, LIKE #{client.table_name});
108
+ CREATE TABLE #{audit_table} (#{audit_table_pk} SERIAL PRIMARY KEY, #{operation_type_column} text, #{trigger_time_column} timestamp, LIKE #{client.table_name}) WITH (autovacuum_enabled = false);
109
109
  SQL
110
110
 
111
111
  Query.run(client.connection, sql)
@@ -177,28 +177,6 @@ module PgOnlineSchemaChange
177
177
  )
178
178
  end
179
179
 
180
- def disable_vacuum!
181
- # re-uses transaction with serializable
182
- # Disabling vacuum to avoid any issues during the process
183
- result = Query.storage_parameters_for(client, client.table_name, true) || ""
184
- Store.set(:primary_table_storage_parameters, result)
185
-
186
- logger.debug(
187
- "Disabling vacuum on shadow and audit table",
188
- { shadow_table: shadow_table, audit_table: audit_table },
189
- )
190
- sql = <<~SQL
191
- ALTER TABLE #{shadow_table} SET (
192
- autovacuum_enabled = false, toast.autovacuum_enabled = false
193
- );
194
-
195
- ALTER TABLE #{audit_table} SET (
196
- autovacuum_enabled = false, toast.autovacuum_enabled = false
197
- );
198
- SQL
199
- Query.run(client.connection, sql, true)
200
- end
201
-
202
180
  def run_alter_statement!
203
181
  # re-uses transaction with serializable
204
182
  statement = Query.alter_statement_for(client, shadow_table)
@@ -81,7 +81,6 @@ module PgOnlineSchemaChange
81
81
  connection.block
82
82
  logger.info("Exception raised, rolling back query", { rollback: true, query: query })
83
83
  connection.async_exec("ROLLBACK;")
84
- connection.async_exec("COMMIT;")
85
84
  raise
86
85
  else
87
86
  connection.async_exec("COMMIT;") unless reuse_trasaction
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgOnlineSchemaChange
4
- VERSION = "0.9.0"
4
+ VERSION = "0.9.2"
5
5
  end
data/scripts/release.sh CHANGED
@@ -1,28 +1,22 @@
1
+ #!/bin/bash
2
+
3
+ set -euo pipefail
4
+
1
5
  export VERSION=$1
2
6
  echo "VERSION: ${VERSION}"
3
7
 
4
- echo "=== Pushing tags to github ===="
5
- git tag v$VERSION
6
- git push origin --tags
7
-
8
8
  echo "=== Building Gem ===="
9
9
  gem build pg_online_schema_change.gemspec
10
10
 
11
11
  echo "=== Pushing gem ===="
12
- gem push pg_online_schema_change-$VERSION.gem
12
+ gem push pg_online_schema_change-"$VERSION".gem
13
13
 
14
- echo "=== Sleeping for 5s ===="
15
- sleep 5
14
+ echo "=== Sleeping for 15s ===="
15
+ sleep 15
16
16
 
17
- echo "=== Building Image ===="
18
- docker build . --build-arg VERSION=$VERSION -t shayonj/pg-osc:$VERSION
19
-
20
- echo "=== Tagging Image ===="
21
- docker image tag shayonj/pg-osc:$VERSION shayonj/pg-osc:latest
22
-
23
- echo "=== Pushing Image ===="
24
- docker push shayonj/pg-osc:$VERSION
25
- docker push shayonj/pg-osc:latest
17
+ echo "=== Pushing tags to github ===="
18
+ git tag v"$VERSION"
19
+ git push origin --tags
26
20
 
27
21
  echo "=== Cleaning up ===="
28
- rm pg_online_schema_change-$VERSION.gem
22
+ rm pg_online_schema_change-"$VERSION".gem
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.0
4
+ version: 0.9.2
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-05-22 00:00:00.000000000 Z
11
+ date: 2023-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ougai
@@ -28,30 +28,42 @@ dependencies:
28
28
  name: pg
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.3.2
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: 1.6.0
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: 1.3.2
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: 1.6.0
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: pg_query
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - "~>"
51
+ - - ">="
46
52
  - !ruby/object:Gem::Version
47
53
  version: 2.1.3
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: 4.3.0
48
57
  type: :runtime
49
58
  prerelease: false
50
59
  version_requirements: !ruby/object:Gem::Requirement
51
60
  requirements:
52
- - - "~>"
61
+ - - ">="
53
62
  - !ruby/object:Gem::Version
54
63
  version: 2.1.3
64
+ - - "<"
65
+ - !ruby/object:Gem::Version
66
+ version: 4.3.0
55
67
  - !ruby/object:Gem::Dependency
56
68
  name: thor
57
69
  requirement: !ruby/object:Gem::Requirement