pg_ha_migrations 1.2.5 → 1.3.0
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 +4 -4
- data/.github/workflows/ci.yml +1 -0
- data/Appraisals +4 -0
- data/bin/setup +4 -1
- data/gemfiles/rails_6.1.gemfile +7 -0
- data/lib/pg_ha_migrations/allowed_versions.rb +1 -1
- data/lib/pg_ha_migrations/safe_statements.rb +9 -2
- data/lib/pg_ha_migrations/version.rb +1 -1
- data/pg_ha_migrations.gemspec +2 -2
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 642f8332dd491d8b489d7044c8989bcfc8a7e34c63ad380c42ed3e78f45c5c8f
|
4
|
+
data.tar.gz: 0bec0715601bce8ddd77d83c03c399b2dff21039301a72b67899d5041012c231
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b40ccad5d82c2f2167515eca20da2152482c7e9cd11b84dbf721b0840c7c40462a8818d4bb8dbea840196171185dd3ddc1fb28e205f96a7845cc9c3df69d1a67
|
7
|
+
data.tar.gz: 2a07b86116d69ee0a51ec8b9d7fb4bcc6ba876e363df79902e7bed3f7ab123bd9f4c4c21b15ba538c0d8850b6f82c353f0c02fa7ad2ac11f8f84ee1f29787bd6
|
data/.github/workflows/ci.yml
CHANGED
data/Appraisals
CHANGED
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
|
15
|
+
docker run -d -p 127.0.0.1:5432:5432 -e POSTGRES_PASSWORD="${PGPASSWORD}" postgres:${PGVERSION}
|
@@ -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
|
-
|
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
|
|
data/pg_ha_migrations.gemspec
CHANGED
@@ -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.
|
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.
|
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.
|
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-
|
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.
|
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.
|
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.
|
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.
|
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
|