add Gitlab::Database.replication_slots_supported?
This commit is contained in:
parent
784edd654b
commit
02d97d4621
|
@ -50,6 +50,10 @@ module Gitlab
|
|||
postgresql? && version.to_f >= 9.3
|
||||
end
|
||||
|
||||
def self.replication_slots_supported?
|
||||
postgresql? && version.to_f >= 9.4
|
||||
end
|
||||
|
||||
def self.nulls_last_order(field, direction = 'ASC')
|
||||
order = "#{field} #{direction}"
|
||||
|
||||
|
|
|
@ -73,6 +73,28 @@ describe Gitlab::Database do
|
|||
end
|
||||
end
|
||||
|
||||
describe '.replication_slots_supported?' do
|
||||
it 'returns false when using MySQL' do
|
||||
allow(described_class).to receive(:postgresql?).and_return(false)
|
||||
|
||||
expect(described_class.replication_slots_supported?).to eq(false)
|
||||
end
|
||||
|
||||
it 'returns false when using PostgreSQL 9.3' do
|
||||
allow(described_class).to receive(:postgresql?).and_return(true)
|
||||
allow(described_class).to receive(:version).and_return('9.3.1')
|
||||
|
||||
expect(described_class.replication_slots_supported?).to eq(false)
|
||||
end
|
||||
|
||||
it 'returns true when using PostgreSQL 9.4.0 or newer' do
|
||||
allow(described_class).to receive(:postgresql?).and_return(true)
|
||||
allow(described_class).to receive(:version).and_return('9.4.0')
|
||||
|
||||
expect(described_class.replication_slots_supported?).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
describe '.nulls_last_order' do
|
||||
context 'when using PostgreSQL' do
|
||||
before do
|
||||
|
|
Loading…
Reference in New Issue