pg_ha_migrations 1.2.5 → 1.3.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: aa56359f3f0d8d56cc060ffbda09e40a234bbd80581de50d637caf8fc5ffb94b
4
- data.tar.gz: e53c77e2a38349e16e8dd977747b0bb1691ed7a4643a7ae5dda26d05ef3cf71e
3
+ metadata.gz: 642f8332dd491d8b489d7044c8989bcfc8a7e34c63ad380c42ed3e78f45c5c8f
4
+ data.tar.gz: 0bec0715601bce8ddd77d83c03c399b2dff21039301a72b67899d5041012c231
5
5
  SHA512:
6
- metadata.gz: ffca13e9164a6d1a82b03fcb521707aef486d78385db1e48f5c43d7702399316d1616a166e89e917f28c18f7aba06b3eec89316c34218ecab851599132b688c6
7
- data.tar.gz: 657e725471a0caad6e100e0cb009f242b2af4d2eaf4385d65c02623e0366d57ff4d24a6dcc71ba1457e34f80f972d9c0a0704bf238f0442fa902df119440146c
6
+ metadata.gz: b40ccad5d82c2f2167515eca20da2152482c7e9cd11b84dbf721b0840c7c40462a8818d4bb8dbea840196171185dd3ddc1fb28e205f96a7845cc9c3df69d1a67
7
+ data.tar.gz: 2a07b86116d69ee0a51ec8b9d7fb4bcc6ba876e363df79902e7bed3f7ab123bd9f4c4c21b15ba538c0d8850b6f82c353f0c02fa7ad2ac11f8f84ee1f29787bd6
@@ -14,6 +14,7 @@ jobs:
14
14
  - rails_5.1
15
15
  - rails_5.2
16
16
  - rails_6.0
17
+ - rails_6.1
17
18
  name: PostgreSQL ${{ matrix.pg }}
18
19
  runs-on: ubuntu-latest
19
20
  env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
data/Appraisals CHANGED
@@ -14,3 +14,7 @@ appraise "rails-6.0" do
14
14
  gem "rails", "6.0.0"
15
15
  end
16
16
 
17
+ appraise "rails-6.1" do
18
+ gem "rails", "6.1.0"
19
+ end
20
+
data/bin/setup CHANGED
@@ -2,6 +2,9 @@
2
2
  set -euo pipefail
3
3
  IFS=$'\n\t'
4
4
  set -vx
5
+ export PGPASSWORD="${PGPASSWORD:-postgres}"
6
+ PGVERSION="${PGVERSION:-13}"
7
+
5
8
 
6
9
  bundle install
7
10
  bundle exec appraisal install
@@ -9,4 +12,4 @@ bundle exec appraisal install
9
12
  # Do any other automated setup that you need to do here
10
13
 
11
14
  # Launch a blank postgres image for testing
12
- docker run -d -p 127.0.0.1:5432:5432 postgres:10
15
+ docker run -d -p 127.0.0.1:5432:5432 -e POSTGRES_PASSWORD="${PGPASSWORD}" postgres:${PGVERSION}
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "6.1.0"
6
+
7
+ gemspec path: "../"
@@ -1,7 +1,7 @@
1
1
  require "active_record/migration/compatibility"
2
2
 
3
3
  module PgHaMigrations::AllowedVersions
4
- ALLOWED_VERSIONS = [4.2, 5.0, 5.1, 5.2, 6.0].map do |v|
4
+ ALLOWED_VERSIONS = [4.2, 5.0, 5.1, 5.2, 6.0, 6.1].map do |v|
5
5
  begin
6
6
  ActiveRecord::Migration[v]
7
7
  rescue ArgumentError
@@ -34,14 +34,21 @@ module PgHaMigrations::SafeStatements
34
34
  end
35
35
 
36
36
  def safe_add_column(table, column, type, options = {})
37
+ # Note: we don't believe we need to consider the odd case where
38
+ # `:default => nil` or `:default => -> { null }` (or similar) is
39
+ # passed because:
40
+ # - It's OK to exclude that case with an "unnecessary" `raise`
41
+ # below as it doesn't make semantic sense anyway.
42
+ # - If `:null => false` is also passed we are assuming Postgres's
43
+ # seq scan of the table (to verify the NOT NULL constraint) will
44
+ # short-circuit (though we have not confirmed that).
37
45
  if options.has_key?(:default)
38
46
  if ActiveRecord::Base.connection.postgresql_version < 11_00_00
39
47
  raise PgHaMigrations::UnsafeMigrationError.new(":default is NOT SAFE! Use safe_change_column_default afterwards then backfill the data to prevent locking the table")
40
48
  elsif options[:default].is_a?(Proc) || (options[:default].is_a?(String) && !([:string, :text, :binary].include?(type.to_sym) || _type_is_enum(type)))
41
49
  raise PgHaMigrations::UnsafeMigrationError.new(":default is not safe if the default value is volatile. Use safe_change_column_default afterwards then backfill the data to prevent locking the table")
42
50
  end
43
- end
44
- if options[:null] == false
51
+ elsif options[:null] == false
45
52
  raise PgHaMigrations::UnsafeMigrationError.new(":null => false is NOT SAFE if the table has data! If you _really_ want to do this, use unsafe_make_column_not_nullable")
46
53
  end
47
54
 
@@ -1,3 +1,3 @@
1
1
  module PgHaMigrations
2
- VERSION = "1.2.5"
2
+ VERSION = "1.3.0"
3
3
  end
@@ -32,11 +32,11 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency "rake", "~> 10.0"
33
33
  spec.add_development_dependency "rspec", "~> 3.0"
34
34
  spec.add_development_dependency "pg"
35
- spec.add_development_dependency "db-query-matchers", "~> 0.9.0"
35
+ spec.add_development_dependency "db-query-matchers", "~> 0.10.0"
36
36
  spec.add_development_dependency "pry"
37
37
  spec.add_development_dependency "pry-byebug"
38
38
  spec.add_development_dependency "appraisal", "~> 2.2.0"
39
39
 
40
- spec.add_dependency "rails", ">= 5.0", "< 6.1"
40
+ spec.add_dependency "rails", ">= 5.0", "< 6.2"
41
41
  spec.add_dependency "relation_to_struct", ">= 1.5.1"
42
42
  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.2.5
4
+ version: 1.3.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: 2021-03-05 00:00:00.000000000 Z
17
+ date: 2021-09-14 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rake
@@ -64,14 +64,14 @@ dependencies:
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: 0.9.0
67
+ version: 0.10.0
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: 0.9.0
74
+ version: 0.10.0
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: pry
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -123,7 +123,7 @@ dependencies:
123
123
  version: '5.0'
124
124
  - - "<"
125
125
  - !ruby/object:Gem::Version
126
- version: '6.1'
126
+ version: '6.2'
127
127
  type: :runtime
128
128
  prerelease: false
129
129
  version_requirements: !ruby/object:Gem::Requirement
@@ -133,7 +133,7 @@ dependencies:
133
133
  version: '5.0'
134
134
  - - "<"
135
135
  - !ruby/object:Gem::Version
136
- version: '6.1'
136
+ version: '6.2'
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: relation_to_struct
139
139
  requirement: !ruby/object:Gem::Requirement
@@ -175,6 +175,7 @@ files:
175
175
  - gemfiles/rails_5.1.gemfile
176
176
  - gemfiles/rails_5.2.gemfile
177
177
  - gemfiles/rails_6.0.gemfile
178
+ - gemfiles/rails_6.1.gemfile
178
179
  - lib/pg_ha_migrations.rb
179
180
  - lib/pg_ha_migrations/allowed_versions.rb
180
181
  - lib/pg_ha_migrations/blocking_database_transactions.rb