Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
02d97d46
Commit
02d97d46
authored
Dec 05, 2017
by
Brett Walker
Committed by
Stan Hu
Dec 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Gitlab::Database.replication_slots_supported?
parent
784edd65
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
lib/gitlab/database.rb
lib/gitlab/database.rb
+4
-0
spec/lib/gitlab/database_spec.rb
spec/lib/gitlab/database_spec.rb
+22
-0
No files found.
lib/gitlab/database.rb
View file @
02d97d46
...
@@ -50,6 +50,10 @@ module Gitlab
...
@@ -50,6 +50,10 @@ module Gitlab
postgresql?
&&
version
.
to_f
>=
9.3
postgresql?
&&
version
.
to_f
>=
9.3
end
end
def
self
.
replication_slots_supported?
postgresql?
&&
version
.
to_f
>=
9.4
end
def
self
.
nulls_last_order
(
field
,
direction
=
'ASC'
)
def
self
.
nulls_last_order
(
field
,
direction
=
'ASC'
)
order
=
"
#{
field
}
#{
direction
}
"
order
=
"
#{
field
}
#{
direction
}
"
...
...
spec/lib/gitlab/database_spec.rb
View file @
02d97d46
...
@@ -73,6 +73,28 @@ describe Gitlab::Database do
...
@@ -73,6 +73,28 @@ describe Gitlab::Database do
end
end
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
describe
'.nulls_last_order'
do
context
'when using PostgreSQL'
do
context
'when using PostgreSQL'
do
before
do
before
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment