safe-pg-migrations 2.2.1 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/safe-pg-migrations/base.rb +1 -0
- data/lib/safe-pg-migrations/helpers/statements_helper.rb +19 -0
- data/lib/safe-pg-migrations/plugins/blocking_activity_logger.rb +2 -9
- data/lib/safe-pg-migrations/plugins/statement_retrier.rb +1 -3
- data/lib/safe-pg-migrations/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a0df9e7452f957e5b9d5bde43186d621c8b8b4dab8f0131e100c295f03876bf
|
4
|
+
data.tar.gz: 461407396bd567c37f8f361dcc45386691aa502828913b0954cc8e3cbe305fff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28e27ecdfd15480ae55a49357200f9b5e0ed4af1ac943973925ca5ac091c7b61ce50dca8047b6a24fe42a736a1214bfb56a08a7f791e59dfbce14587c10e7585
|
7
|
+
data.tar.gz: f70e209ad111bf97d7a0fa8aea884a3191bc5ee028b67d5e445a553549c00e86f01cd948368e7b3f93ee1713724877d9e67272f6e5729cc71b69cddbac62316d
|
@@ -6,6 +6,7 @@ require 'safe-pg-migrations/helpers/satisfied_helper'
|
|
6
6
|
require 'safe-pg-migrations/helpers/index_helper'
|
7
7
|
require 'safe-pg-migrations/helpers/batch_over'
|
8
8
|
require 'safe-pg-migrations/helpers/session_setting_management'
|
9
|
+
require 'safe-pg-migrations/helpers/statements_helper'
|
9
10
|
require 'safe-pg-migrations/plugins/verbose_sql_logger'
|
10
11
|
require 'safe-pg-migrations/plugins/blocking_activity_logger'
|
11
12
|
require 'safe-pg-migrations/plugins/statement_insurer/add_column'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SafePgMigrations
|
4
|
+
module Helpers
|
5
|
+
module StatementsHelper
|
6
|
+
RETRIABLE_SCHEMA_STATEMENTS = %i[
|
7
|
+
add_check_constraint
|
8
|
+
add_column
|
9
|
+
add_foreign_key
|
10
|
+
change_column_default
|
11
|
+
change_column_null
|
12
|
+
create_table
|
13
|
+
remove_column
|
14
|
+
remove_foreign_key
|
15
|
+
drop_table
|
16
|
+
].freeze
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -7,16 +7,9 @@ module SafePgMigrations
|
|
7
7
|
module BlockingActivityLogger
|
8
8
|
include Helpers::BlockingActivityFormatter
|
9
9
|
include Helpers::BlockingActivitySelector
|
10
|
+
include Helpers::StatementsHelper
|
10
11
|
|
11
|
-
|
12
|
-
add_column
|
13
|
-
remove_column
|
14
|
-
add_foreign_key
|
15
|
-
remove_foreign_key
|
16
|
-
change_column_default
|
17
|
-
change_column_null
|
18
|
-
create_table
|
19
|
-
].each do |method|
|
12
|
+
RETRIABLE_SCHEMA_STATEMENTS.each do |method|
|
20
13
|
define_method method do |*args, &block|
|
21
14
|
log_context = lambda do
|
22
15
|
break unless SafePgMigrations.config.sensitive_logger
|
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
module SafePgMigrations
|
4
4
|
module StatementRetrier
|
5
|
-
|
6
|
-
add_column add_foreign_key remove_foreign_key change_column_default change_column_null remove_column drop_table
|
7
|
-
].freeze
|
5
|
+
include Helpers::StatementsHelper
|
8
6
|
|
9
7
|
RETRIABLE_SCHEMA_STATEMENTS.each do |method|
|
10
8
|
define_method method do |*args, &block|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safe-pg-migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthieu Prat
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-
|
13
|
+
date: 2023-08-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- lib/safe-pg-migrations/helpers/logger.rb
|
59
59
|
- lib/safe-pg-migrations/helpers/satisfied_helper.rb
|
60
60
|
- lib/safe-pg-migrations/helpers/session_setting_management.rb
|
61
|
+
- lib/safe-pg-migrations/helpers/statements_helper.rb
|
61
62
|
- lib/safe-pg-migrations/plugins/blocking_activity_logger.rb
|
62
63
|
- lib/safe-pg-migrations/plugins/idempotent_statements.rb
|
63
64
|
- lib/safe-pg-migrations/plugins/statement_insurer.rb
|