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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5effa97634fe0a432ff8176cfc7638e6435eb8765246a8cbc9c61444488e6c6
4
- data.tar.gz: '08965111ea15df0a4b1011c514fbac358265b953239e13253702ca65fb7669bf'
3
+ metadata.gz: ae8983eec2507ce164936c65c32a7c296d0d3ef338ada2d90d68f37c572d00f7
4
+ data.tar.gz: 9c07cb77837a23a603e713e94cdae71f26acce82dbc2332d6fd77260c54d7c8c
5
5
  SHA512:
6
- metadata.gz: 5b4649d6a4473d82441b6ea6f55105b313fac1ad75dc1938fbcc71ec16257a46e89ae9b09f7d95d645e184d093cc5b55ff550df846793842d9670f2491514766
7
- data.tar.gz: 61241d289fde274935041a8b1401c5a0a4d49188b5f594949d5cbae7b1e410e3cf56c45e4521c00f4e4b2be644f37a7546c3e24570ccb418c96c0553d3fb6da2
6
+ metadata.gz: 247dd7ac257a208ef985d86b94710fbf41c0e622d02ce1acecb46d490ab17adb6aa080060d6e48ddf56e8ef4a5289121dcf4edd41e83f3bb7418ce20cfc91d4c
7
+ data.tar.gz: 0f0fb4ac98e6732d7d020a55e0f2608e256dbf34b4fe669ccfcde7e1878df43b3ccd8e153af61e6681d5eec62b8269ea435303376136207af54341d8bb19da41
@@ -1 +1 @@
1
- ruby-2.4.3
1
+ ruby-2.5.7
@@ -1,16 +1,28 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.4
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
@@ -10,3 +10,7 @@ appraise "rails-5.2" do
10
10
  gem "rails", "5.2.3"
11
11
  end
12
12
 
13
+ appraise "rails-6.0" do
14
+ gem "rails", "6.0.0"
15
+ end
16
+
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "6.0.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].map do |v|
4
+ ALLOWED_VERSIONS = [4.2, 5.0, 5.1, 5.2, 6.0].map do |v|
5
5
  begin
6
6
  ActiveRecord::Migration[v]
7
7
  rescue ArgumentError
@@ -25,13 +25,19 @@ module PgHaMigrations
25
25
  end
26
26
 
27
27
  def self.find_blocking_transactions(minimum_transaction_age = "0 seconds")
28
- pid_column, query_column = if ActiveRecord::Base.connection.select_value("SHOW server_version") =~ /9\.1/
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
- raw_query = <<-SQL
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 << <<-eos.strip_heredoc.lines.map { |line| "\t#{line}" }.join
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
@@ -1,3 +1,3 @@
1
1
  module PgHaMigrations
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.3"
3
3
  end
@@ -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", "< 5.3"
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.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-04 00:00:00.000000000 Z
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: '5.3'
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: '5.3'
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: '0'
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: '0'
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