Update pg gem required version to 1.1

This is required for #39063 to use `PG::TextDecoder::Numeric`.

Ref https://github.com/ged/ruby-pg/pull/25.

The pg gem 1.1.0 was released at August 24, 2018, so I think it is good
timing to bump the required version for improving and cleaning up the
code base.

https://rubygems.org/gems/pg/versions
This commit is contained in:
Ryuta Kamizono 2020-04-27 02:50:44 +09:00
parent 3de9669188
commit 592358e182
7 changed files with 9 additions and 22 deletions

View File

@ -127,7 +127,7 @@ platforms :ruby, :mswin, :mswin64, :mingw, :x64_mingw do
gem "sqlite3", "~> 1.4"
group :db do
gem "pg", ">= 0.18.0"
gem "pg", "~> 1.1"
gem "mysql2", "~> 0.5"
end
end

View File

@ -569,7 +569,7 @@ DEPENDENCIES
minitest-retry
mysql2 (~> 0.5)
nokogiri (>= 1.8.1)
pg (>= 0.18.0)
pg (~> 1.1)
psych (~> 3.0)
puma
que

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
gem "pg", ">= 0.18", "< 2.0"
gem "pg", "~> 1.1"
require "pg"
require "thread"
require "digest/sha1"

View File

@ -1,17 +1,8 @@
# frozen_string_literal: true
# Make sure we're using pg high enough for type casts and Ruby 2.2+ compatibility
gem "pg", ">= 0.18", "< 2.0"
gem "pg", "~> 1.1"
require "pg"
# Use async_exec instead of exec_params on pg versions before 1.1
class ::PG::Connection # :nodoc:
unless self.public_method_defined?(:async_exec_params)
remove_method :exec_params
alias exec_params async_exec
end
end
require "active_support/core_ext/object/try"
require "active_record/connection_adapters/abstract_adapter"
require "active_record/connection_adapters/statement_pool"
@ -905,14 +896,10 @@ module ActiveRecord
"float4" => PG::TextDecoder::Float,
"float8" => PG::TextDecoder::Float,
"bool" => PG::TextDecoder::Boolean,
"timestamp" => PG::TextDecoder::TimestampUtc,
"timestamptz" => PG::TextDecoder::TimestampWithTimeZone,
}
if defined?(PG::TextDecoder::TimestampUtc)
# Use native PG encoders available since pg-1.1
coders_by_name["timestamp"] = PG::TextDecoder::TimestampUtc
coders_by_name["timestamptz"] = PG::TextDecoder::TimestampWithTimeZone
end
known_coder_types = coders_by_name.keys.map { |n| quote(n) }
query = <<~SQL % known_coder_types.join(", ")
SELECT t.oid, t.typname

View File

@ -14,7 +14,7 @@ module Rails
def gem_for_database(database = options[:database])
case database
when "mysql" then ["mysql2", ["~> 0.5"]]
when "postgresql" then ["pg", [">= 0.18", "< 2.0"]]
when "postgresql" then ["pg", ["~> 1.1"]]
when "sqlite3" then ["sqlite3", ["~> 1.4"]]
when "oracle" then ["activerecord-oracle_enhanced-adapter", nil]
when "sqlserver" then ["activerecord-sqlserver-adapter", nil]

View File

@ -547,7 +547,7 @@ class AppGeneratorTest < Rails::Generators::TestCase
if defined?(JRUBY_VERSION)
assert_gem "activerecord-jdbcpostgresql-adapter"
else
assert_gem "pg", "'>= 0.18', '< 2.0'"
assert_gem "pg", "'~> 1.1'"
end
end

View File

@ -40,7 +40,7 @@ module Rails
assert_file("Gemfile") do |content|
assert_match "# Use pg as the database for Active Record", content
assert_match "gem 'pg', '>= 0.18', '< 2.0'", content
assert_match "gem 'pg', '~> 1.1'", content
end
end