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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
b2df1185
Commit
b2df1185
authored
Jun 15, 2016
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Random selection now also works for MySQL
parent
7dc08033
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
db/fixtures/development/15_award_emoji.rb
db/fixtures/development/15_award_emoji.rb
+3
-3
lib/gitlab/database.rb
lib/gitlab/database.rb
+4
-0
No files found.
db/fixtures/development/15_award_emoji.rb
View file @
b2df1185
Gitlab
::
Seeder
.
quiet
do
emoji
=
Gitlab
::
AwardEmoji
.
emojis
.
keys
issue_count
=
Issue
.
count
/
2
Issue
.
order
(
"RANDOM()"
).
limit
(
Issue
.
count
/
2
).
each
do
|
issue
|
Issue
.
order
(
Gitlab
::
Database
.
random
).
limit
(
Issue
.
count
/
2
).
each
do
|
issue
|
project
=
issue
.
project
project
.
team
.
users
.
sample
(
2
).
each
do
|
user
|
...
...
@@ -16,7 +16,7 @@ Gitlab::Seeder.quiet do
end
end
MergeRequest
.
order
(
"RANDOM()"
).
limit
(
MergeRequest
.
count
/
2
).
each
do
|
mr
|
MergeRequest
.
order
(
Gitlab
::
Database
.
random
).
limit
(
MergeRequest
.
count
/
2
).
each
do
|
mr
|
project
=
mr
.
project
project
.
team
.
users
.
sample
(
2
).
each
do
|
user
|
...
...
lib/gitlab/database.rb
View file @
b2df1185
...
...
@@ -30,6 +30,10 @@ module Gitlab
order
end
def
self
.
random
Gitlab
::
Database
.
postgresql?
?
"RANDOM()"
:
"RAND()"
end
def
true_value
if
Gitlab
::
Database
.
postgresql?
"'t'"
...
...
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