FIX: backups taken by pg_dump >= 11 are nonportable (#7893)
This commit is contained in:
parent
e8ee392186
commit
08b286808a
|
@ -11,7 +11,7 @@ module BackupRestore
|
||||||
attr_reader :success
|
attr_reader :success
|
||||||
|
|
||||||
def self.pg_produces_portable_dump?(version)
|
def self.pg_produces_portable_dump?(version)
|
||||||
version = Gem::Version.new(version)
|
gem_version = Gem::Version.new(version)
|
||||||
|
|
||||||
%w{
|
%w{
|
||||||
10.3
|
10.3
|
||||||
|
@ -20,7 +20,9 @@ module BackupRestore
|
||||||
9.4.17
|
9.4.17
|
||||||
9.3.22
|
9.3.22
|
||||||
}.each do |unportable_version|
|
}.each do |unportable_version|
|
||||||
return false if Gem::Dependency.new("", "~> #{unportable_version}").match?("", version)
|
# anything pg 11 or above will produce a non-portable dump
|
||||||
|
return false if version.to_i >= 11
|
||||||
|
return false if Gem::Dependency.new("", "~> #{unportable_version}").match?("", gem_version)
|
||||||
end
|
end
|
||||||
|
|
||||||
true
|
true
|
||||||
|
|
|
@ -12,6 +12,9 @@ describe BackupRestore::Restorer do
|
||||||
"10.3" => false,
|
"10.3" => false,
|
||||||
"10.3.1" => false,
|
"10.3.1" => false,
|
||||||
"10.4" => false,
|
"10.4" => false,
|
||||||
|
"11" => false,
|
||||||
|
"11.4" => false,
|
||||||
|
"21" => false,
|
||||||
}.each do |key, value|
|
}.each do |key, value|
|
||||||
expect(described_class.pg_produces_portable_dump?(key)).to eq(value)
|
expect(described_class.pg_produces_portable_dump?(key)).to eq(value)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue