pg_ha_migrations 1.5.0 → 1.6.0

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: a5eb93231a1de0f12819682bfe42606bf0cc49813a50b91670107f01eafe8f18
4
- data.tar.gz: adcea5f591af66bb790118c562a0cab80dca009421529437d2586e6c0b957f01
3
+ metadata.gz: 6962b68069791fd1de1da3dd1f8a3bb34438faf217023fdcc05d792eb345a666
4
+ data.tar.gz: 450e7710be2bac4d25e77dabfb7eff9048f9321ebcf90a428a6125edab848f69
5
5
  SHA512:
6
- metadata.gz: c7c827c5385b13a438a4a2cf1eaa1b7535e54e6d3293f67616849647706ca869a1362db4e102e66802f0930d450a09e3943d365a6b9d7481871c286c3fba1a36
7
- data.tar.gz: 334f6c562b0b1288690ff6ec1033beb6676446f4c3a5d708d65de93884e85a65a863d985a37bc02a0c30046d34fbd289f9ac5cca50ada30a9e6d4fcdc0d977ac
6
+ metadata.gz: 7467eee266a3c9f49faa84cc771ae35d601b25cc38cfe097b5d696e01dfd317ed1a6b5e67e8a053f80cc262bedf2f3b204dbb4b98732d09688485371613025f1
7
+ data.tar.gz: 63d05306b246ff151d0849967bd71a5457f94d1ac968cc155fcd58e5b359c868a4888167e43fd5775e7bec3bfc8dab9eb71341b80971b4ffd03ed0a189f8ff83
@@ -9,6 +9,8 @@ jobs:
9
9
  - 10
10
10
  - 11
11
11
  - 12
12
+ ruby:
13
+ - 2.7
12
14
  gemfile:
13
15
  - rails_5.0
14
16
  - rails_5.1
@@ -16,6 +18,55 @@ jobs:
16
18
  - rails_6.0
17
19
  - rails_6.1
18
20
  - rails_7.0
21
+ include:
22
+ - gemfile: rails_6.1
23
+ ruby: 3.0
24
+ pg: 9.6
25
+ - gemfile: rails_6.1
26
+ ruby: 3.0
27
+ pg: 10
28
+ - gemfile: rails_6.1
29
+ ruby: 3.0
30
+ pg: 11
31
+ - gemfile: rails_6.1
32
+ ruby: 3.0
33
+ pg: 12
34
+ - gemfile: rails_6.1
35
+ ruby: 3.1
36
+ pg: 9.6
37
+ - gemfile: rails_6.1
38
+ ruby: 3.1
39
+ pg: 10
40
+ - gemfile: rails_6.1
41
+ ruby: 3.1
42
+ pg: 11
43
+ - gemfile: rails_6.1
44
+ ruby: 3.1
45
+ pg: 12
46
+ - gemfile: rails_7.0
47
+ ruby: 3.0
48
+ pg: 9.6
49
+ - gemfile: rails_7.0
50
+ ruby: 3.0
51
+ pg: 10
52
+ - gemfile: rails_7.0
53
+ ruby: 3.0
54
+ pg: 11
55
+ - gemfile: rails_7.0
56
+ ruby: 3.0
57
+ pg: 12
58
+ - gemfile: rails_7.0
59
+ ruby: 3.1
60
+ pg: 9.6
61
+ - gemfile: rails_7.0
62
+ ruby: 3.1
63
+ pg: 10
64
+ - gemfile: rails_7.0
65
+ ruby: 3.1
66
+ pg: 11
67
+ - gemfile: rails_7.0
68
+ ruby: 3.1
69
+ pg: 12
19
70
  name: PostgreSQL ${{ matrix.pg }}
20
71
  runs-on: ubuntu-latest
21
72
  env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
@@ -39,5 +90,6 @@ jobs:
39
90
  - name: Setup Ruby using .ruby-version file
40
91
  uses: ruby/setup-ruby@v1
41
92
  with:
93
+ ruby-version: ${{ matrix.ruby }}
42
94
  bundler-cache: true # runs 'bundle install' and caches installed gems automatically
43
95
  - run: bundle exec rake spec
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "7.0.0"
5
+ gem "rails", "7.0.1"
6
6
 
7
7
  gemspec path: "../"
@@ -65,7 +65,7 @@ module PgHaMigrations::SafeStatements
65
65
 
66
66
  def unsafe_add_column(table, column, type, options = {})
67
67
  safely_acquire_lock_for_table(table) do
68
- super(table, column, type, options)
68
+ super(table, column, type, **options)
69
69
  end
70
70
  end
71
71
 
@@ -145,7 +145,7 @@ module PgHaMigrations::SafeStatements
145
145
  end
146
146
 
147
147
  def safe_add_concurrent_index(table, columns, options={})
148
- unsafe_add_index(table, columns, options.merge(:algorithm => :concurrently))
148
+ unsafe_add_index(table, columns, **options.merge(:algorithm => :concurrently))
149
149
  end
150
150
 
151
151
  def safe_remove_concurrent_index(table, options={})
@@ -157,7 +157,7 @@ module PgHaMigrations::SafeStatements
157
157
  end
158
158
  index_size = select_value("SELECT pg_size_pretty(pg_relation_size('#{options[:name]}'))")
159
159
  say "Preparing to drop index #{options[:name]} which is #{index_size} on disk..."
160
- unsafe_remove_index(table, options.merge(:algorithm => :concurrently))
160
+ unsafe_remove_index(table, **options.merge(:algorithm => :concurrently))
161
161
  end
162
162
 
163
163
  def safe_set_maintenance_work_mem_gb(gigabytes)
@@ -19,6 +19,7 @@ module PgHaMigrations::UnsafeStatements
19
19
 
20
20
  execute_ancestor_statement(method_name, *args, &block)
21
21
  end
22
+ ruby2_keywords method_name
22
23
  end
23
24
 
24
25
  def self.delegate_unsafe_method_to_migration_base_class(method_name)
@@ -29,6 +30,7 @@ module PgHaMigrations::UnsafeStatements
29
30
 
30
31
  execute_ancestor_statement(method_name, *args, &block)
31
32
  end
33
+ ruby2_keywords "unsafe_#{method_name}"
32
34
  end
33
35
 
34
36
  delegate_unsafe_method_to_migration_base_class :add_column
@@ -65,7 +67,7 @@ module PgHaMigrations::UnsafeStatements
65
67
  raise PgHaMigrations::UnsafeMigrationError.new(":force is NOT SAFE! Explicitly call unsafe_drop_table first if you want to recreate an existing table")
66
68
  end
67
69
 
68
- execute_ancestor_statement(:create_table, table, options, &block)
70
+ execute_ancestor_statement(:create_table, table, **options, &block)
69
71
  end
70
72
 
71
73
  def unsafe_add_index(table, column_names, options = {})
@@ -74,11 +76,10 @@ module PgHaMigrations::UnsafeStatements
74
76
  raise PgHaMigrations::InvalidMigrationError, "ActiveRecord drops the :opclass option when supplying a string containing an expression or list of columns; instead either supply an array of columns or include the opclass in the string for each column"
75
77
  end
76
78
 
77
- execute_ancestor_statement(:add_index, table, column_names, options)
79
+ execute_ancestor_statement(:add_index, table, column_names, **options)
78
80
  end
79
81
 
80
-
81
- def execute_ancestor_statement(method_name, *args, &block)
82
+ ruby2_keywords def execute_ancestor_statement(method_name, *args, &block)
82
83
  # Dispatching here is a bit complicated: we need to execute the method
83
84
  # belonging to the first member of the inheritance chain (besides
84
85
  # UnsafeStatements). If don't find the method in the inheritance chain,
@@ -1,3 +1,3 @@
1
1
  module PgHaMigrations
2
- VERSION = "1.5.0"
2
+ VERSION = "1.6.0"
3
3
  end
@@ -3,6 +3,7 @@ require "rails"
3
3
  require "active_record"
4
4
  require "active_record/migration"
5
5
  require "relation_to_struct"
6
+ require "ruby2_keywords"
6
7
 
7
8
  module PgHaMigrations
8
9
  Config = Struct.new(
@@ -39,4 +39,5 @@ Gem::Specification.new do |spec|
39
39
 
40
40
  spec.add_dependency "rails", ">= 5.0", "< 7.1"
41
41
  spec.add_dependency "relation_to_struct", ">= 1.5.1"
42
+ spec.add_dependency "ruby2_keywords"
42
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_ha_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - celeen
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: exe
16
16
  cert_chain: []
17
- date: 2022-05-09 00:00:00.000000000 Z
17
+ date: 2022-07-15 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rake
@@ -148,6 +148,20 @@ dependencies:
148
148
  - - ">="
149
149
  - !ruby/object:Gem::Version
150
150
  version: 1.5.1
151
+ - !ruby/object:Gem::Dependency
152
+ name: ruby2_keywords
153
+ requirement: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ type: :runtime
159
+ prerelease: false
160
+ version_requirements: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ version: '0'
151
165
  description: Enforces DDL/migration safety in Ruby on Rails project with an emphasis
152
166
  on explicitly choosing trade-offs and avoiding unnecessary magic.
153
167
  email: