Commit b2df1185 authored by Z.J. van de Weg's avatar Z.J. van de Weg

Random selection now also works for MySQL

parent 7dc08033
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|
......
......@@ -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'"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment