safe-pg-migrations 1.2.1 → 1.2.2

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: fbda5becc48b8f9c7e0f45820f5f9ef908ba1f1fe56c306f03d3f76fb0197741
4
- data.tar.gz: 4e88da86831d71cb440e1409ad52f3591aabcbd26de248507daffbec0e17698d
3
+ metadata.gz: d981ad3d9694961fa982676398e257817a2f20fb5ef28111c664da67d8caef19
4
+ data.tar.gz: 7792a0f882fe9c594a1a0309bba12f03c2d0d18d5a0ef68fe49e1681da486ba6
5
5
  SHA512:
6
- metadata.gz: e7dfbc18db1959f66a104e37d1f880934b369338b96435efc2db851fe80c092e9cf1e19a092274726dcb35da2fb05035d71a63e404dc89366de6c3483ce2131f
7
- data.tar.gz: a176ae5e044b31ef271359aa9342698e1744e00c3fe99eb8f10c65fa77127671bf5265f4a4e65117df2f22bbc01bbc201ea22ecd2e0faca36e0822cc2f85e2b9
6
+ metadata.gz: a3d03df54c2a401ea4d7d178d66c8fc49c605cebc1e15f87a69e262df2bfc6433ef7ab86ae21e3ce88b52224a0c9fd14c3cf5f923e109ef06da2d55072fc7d3e
7
+ data.tar.gz: b28101c7aedcdfb6fc3680ce9c5b14b459ed90fecf21aaf598942f6c91ebd757f1ed608f71c00e622ec9b24cf1f719a6450ae3ef28abd4f07476fd02f7c54242
data/README.md CHANGED
@@ -16,6 +16,8 @@ Just drop this line in your Gemfile:
16
16
  gem 'safe-pg-migrations'
17
17
  ```
18
18
 
19
+ **Note: Do not run migrations via PgBouncer connection if it is configured to use transactional or statement pooling modes. You must run migrations via a direct Postgres connection, or configure PgBouncer to use session pooling mode.**
20
+
19
21
  ## Example
20
22
 
21
23
  Consider the following migration:
@@ -61,7 +63,7 @@ Under the hood, **Safe PG Migrations** patches `ActiveRecord::Migration` and ext
61
63
 
62
64
  ## Motivation
63
65
 
64
- Writing a safe migration can be daunting. Numerous articles have been written on the topic and a few gems are trying to address the problem. Even for someone who has a pretty good command of Postgres, remembering all the subtleties of explicit locking is not a piece of cake.
66
+ Writing a safe migration can be daunting. Numerous articles, [including ours](https://medium.com/doctolib/stop-worrying-about-postgresql-locks-in-your-rails-migrations-3426027e9cc9), have been written on the topic and a few gems are trying to address the problem. Even for someone who has a pretty good command of Postgres, remembering all the subtleties of explicit locking is not a piece of cake.
65
67
 
66
68
  Active Record means developers don't have to be proficient in SQL to interact with a database. In the same way, **Safe PG Migrations** was created so that developers don't have to understand the ins and outs of Postgres to write a safe migration.
67
69
 
@@ -252,3 +254,4 @@ Interesting reads:
252
254
  - [Rails migrations with no downtime](https://pedro.herokuapp.com/past/2011/7/13/rails_migrations_with_no_downtime/)
253
255
  - [Safe Operations For High Volume PostgreSQL](https://www.braintreepayments.com/blog/safe-operations-for-high-volume-postgresql/)
254
256
  - [Rails Migrations with Zero Downtime](https://blog.codeship.com/rails-migrations-zero-downtime/)
257
+ - [Stop worrying about PostgreSQL locks in your Rails migrations](https://medium.com/doctolib/stop-worrying-about-postgresql-locks-in-your-rails-migrations-3426027e9cc9)
@@ -10,10 +10,10 @@ module SafePgMigrations
10
10
  end
11
11
  end
12
12
 
13
- def add_column(table_name, column_name, type, **options) # rubocop:disable Metrics/CyclomaticComplexity
14
- need_default_value_backfill = SafePgMigrations.pg_version_num < PG_11_VERSION_NUM
13
+ def add_column(table_name, column_name, type, **options)
14
+ return super if SafePgMigrations.pg_version_num >= PG_11_VERSION_NUM
15
15
 
16
- default = options.delete(:default) if need_default_value_backfill
16
+ default = options.delete(:default)
17
17
  null = options.delete(:null)
18
18
 
19
19
  if !default.nil? || null == false
@@ -22,7 +22,7 @@ module SafePgMigrations
22
22
 
23
23
  super
24
24
 
25
- if need_default_value_backfill && !default.nil?
25
+ unless default.nil?
26
26
  SafePgMigrations.say_method_call(:change_column_default, table_name, column_name, default)
27
27
  change_column_default(table_name, column_name, default)
28
28
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SafePgMigrations
4
- VERSION = '1.2.1'
4
+ VERSION = '1.2.2'
5
5
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safe-pg-migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu Prat
8
8
  - Romain Choquet
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-01-19 00:00:00.000000000 Z
12
+ date: 2021-04-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -174,7 +174,7 @@ homepage: https://github.com/doctolib/safe-pg-migrations
174
174
  licenses:
175
175
  - MIT
176
176
  metadata: {}
177
- post_install_message:
177
+ post_install_message:
178
178
  rdoc_options: []
179
179
  require_paths:
180
180
  - lib
@@ -189,9 +189,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  - !ruby/object:Gem::Version
190
190
  version: '0'
191
191
  requirements: []
192
- rubyforge_project:
192
+ rubyforge_project:
193
193
  rubygems_version: 2.7.3
194
- signing_key:
194
+ signing_key:
195
195
  specification_version: 4
196
196
  summary: Make your PG migrations safe.
197
197
  test_files: []