pg_ha_migrations 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +15 -3
- data/Appraisals +4 -0
- data/gemfiles/rails_6.0.gemfile +7 -0
- data/lib/pg_ha_migrations/allowed_versions.rb +1 -1
- data/lib/pg_ha_migrations/blocking_database_transactions.rb +9 -2
- data/lib/pg_ha_migrations/blocking_database_transactions_reporter.rb +1 -1
- 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: ae8983eec2507ce164936c65c32a7c296d0d3ef338ada2d90d68f37c572d00f7
|
4
|
+
data.tar.gz: 9c07cb77837a23a603e713e94cdae71f26acce82dbc2332d6fd77260c54d7c8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 247dd7ac257a208ef985d86b94710fbf41c0e622d02ce1acecb46d490ab17adb6aa080060d6e48ddf56e8ef4a5289121dcf4edd41e83f3bb7418ce20cfc91d4c
|
7
|
+
data.tar.gz: 0f0fb4ac98e6732d7d020a55e0f2608e256dbf34b4fe669ccfcde7e1878df43b3ccd8e153af61e6681d5eec62b8269ea435303376136207af54341d8bb19da41
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.5.7
|
data/.travis.yml
CHANGED
@@ -1,16 +1,28 @@
|
|
1
1
|
sudo: false
|
2
2
|
language: ruby
|
3
3
|
rvm:
|
4
|
-
- 2.
|
4
|
+
- 2.5
|
5
|
+
global:
|
6
|
+
env:
|
7
|
+
PGPORT: 5433
|
8
|
+
env:
|
9
|
+
- PGVERSION: "9.6"
|
10
|
+
- PGVERSION: "10"
|
11
|
+
- PGVERSION: "11"
|
12
|
+
- PGVERSION: "12"
|
5
13
|
services:
|
6
14
|
- postgresql
|
7
|
-
addons:
|
8
|
-
postgresql: "9.6"
|
9
15
|
before_install:
|
16
|
+
- sudo service postgresql stop
|
17
|
+
- sudo apt-get update
|
18
|
+
- sudo apt-get -y install postgresql-$PGVERSION postgresql-client-$PGVERSION postgresql-server-dev-$PGVERSION postgresql-client-common postgresql-common
|
19
|
+
- if [ $PGVERSION != '9.6' ]; then sudo cp /etc/postgresql/{9.6,$PGVERSION}/main/pg_hba.conf; fi
|
20
|
+
- sudo service postgresql restart $PGVERSION
|
10
21
|
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
11
22
|
- gem install bundler -v 1.15.4
|
12
23
|
gemfile:
|
13
24
|
- gemfiles/rails_5.0.gemfile
|
14
25
|
- gemfiles/rails_5.1.gemfile
|
15
26
|
- gemfiles/rails_5.2.gemfile
|
27
|
+
- gemfiles/rails_6.0.gemfile
|
16
28
|
script: "bundle exec rake spec"
|
data/Appraisals
CHANGED
@@ -25,13 +25,19 @@ module PgHaMigrations
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.find_blocking_transactions(minimum_transaction_age = "0 seconds")
|
28
|
-
|
28
|
+
postgres_version = ActiveRecord::Base.connection.postgresql_version
|
29
|
+
pid_column, query_column = if postgres_version < 9_02_00
|
29
30
|
["procpid", "current_query"]
|
30
31
|
else
|
31
32
|
["pid", "query"]
|
32
33
|
end
|
33
34
|
|
34
|
-
|
35
|
+
# In some versions of Postgres, walsenders show up here with a non-null xact_start.
|
36
|
+
# That's been patched, so hard to test, but we should exclude them anyway.
|
37
|
+
# https://www.postgresql.org/message-id/flat/20191209234409.exe7osmyalwkt5j4%40development
|
38
|
+
ignore_sqlsender_sql = "psa.backend_type != 'walsender'"
|
39
|
+
|
40
|
+
raw_query = <<~SQL
|
35
41
|
SELECT
|
36
42
|
psa.datname as database, -- Will only ever be one database
|
37
43
|
psa.#{query_column} as current_query,
|
@@ -59,6 +65,7 @@ module PgHaMigrations
|
|
59
65
|
)
|
60
66
|
AND psa.xact_start < clock_timestamp() - ?::interval
|
61
67
|
AND psa.#{query_column} !~ ?
|
68
|
+
#{postgres_version >= 10_00_00 ? "AND #{ignore_sqlsender_sql}" : ""}
|
62
69
|
GROUP BY psa.datname, psa.#{query_column}, psa.state, psa.xact_start
|
63
70
|
SQL
|
64
71
|
|
@@ -24,7 +24,7 @@ module PgHaMigrations
|
|
24
24
|
end
|
25
25
|
|
26
26
|
if blocking_transactions.any?(&:concurrent_index_creation?)
|
27
|
-
report <<
|
27
|
+
report << <<~eos.lines.map { |line| "\t#{line}" }.join
|
28
28
|
Warning: concurrent indexes are currently being built. If you have any other
|
29
29
|
migrations in this deploy that will attempt to create additional
|
30
30
|
concurrent indexes on the same physical database (even if the table
|
data/pg_ha_migrations.gemspec
CHANGED
@@ -37,6 +37,6 @@ Gem::Specification.new do |spec|
|
|
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", "<
|
41
|
-
spec.add_dependency "relation_to_struct"
|
40
|
+
spec.add_dependency "rails", ">= 5.0", "< 6.1"
|
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.
|
4
|
+
version: 1.2.3
|
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: 2020-03-
|
17
|
+
date: 2020-03-12 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: rake
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
version: '5.0'
|
124
124
|
- - "<"
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: '
|
126
|
+
version: '6.1'
|
127
127
|
type: :runtime
|
128
128
|
prerelease: false
|
129
129
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -133,21 +133,21 @@ dependencies:
|
|
133
133
|
version: '5.0'
|
134
134
|
- - "<"
|
135
135
|
- !ruby/object:Gem::Version
|
136
|
-
version: '
|
136
|
+
version: '6.1'
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
138
|
name: relation_to_struct
|
139
139
|
requirement: !ruby/object:Gem::Requirement
|
140
140
|
requirements:
|
141
141
|
- - ">="
|
142
142
|
- !ruby/object:Gem::Version
|
143
|
-
version:
|
143
|
+
version: 1.5.1
|
144
144
|
type: :runtime
|
145
145
|
prerelease: false
|
146
146
|
version_requirements: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
148
|
- - ">="
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version:
|
150
|
+
version: 1.5.1
|
151
151
|
description: Enforces DDL/migration safety in Ruby on Rails project with an emphasis
|
152
152
|
on explicitly choosing trade-offs and avoiding unnecessary magic.
|
153
153
|
email:
|
@@ -173,6 +173,7 @@ files:
|
|
173
173
|
- gemfiles/rails_5.0.gemfile
|
174
174
|
- gemfiles/rails_5.1.gemfile
|
175
175
|
- gemfiles/rails_5.2.gemfile
|
176
|
+
- gemfiles/rails_6.0.gemfile
|
176
177
|
- lib/pg_ha_migrations.rb
|
177
178
|
- lib/pg_ha_migrations/allowed_versions.rb
|
178
179
|
- lib/pg_ha_migrations/blocking_database_transactions.rb
|