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
Boxiang Sun
gitlab-ce
Commits
faf94535
Commit
faf94535
authored
Jun 26, 2018
by
Jasper Maes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rails5 fix arel from in mysql_median_datetime_sql
parent
0139c221
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
changelogs/unreleased/rails5-fix-mysql-arel-from.yml
changelogs/unreleased/rails5-fix-mysql-arel-from.yml
+5
-0
lib/gitlab/database/median.rb
lib/gitlab/database/median.rb
+7
-1
No files found.
changelogs/unreleased/rails5-fix-mysql-arel-from.yml
0 → 100644
View file @
faf94535
---
title
:
Rails5 fix arel from in mysql_median_datetime_sql
merge_request
:
20167
author
:
Jasper Maes
type
:
fixed
lib/gitlab/database/median.rb
View file @
faf94535
...
@@ -33,7 +33,13 @@ module Gitlab
...
@@ -33,7 +33,13 @@ module Gitlab
end
end
def
mysql_median_datetime_sql
(
arel_table
,
query_so_far
,
column_sym
)
def
mysql_median_datetime_sql
(
arel_table
,
query_so_far
,
column_sym
)
query
=
arel_table
arel_from
=
if
Gitlab
.
rails5?
arel_table
.
from
else
arel_table
end
query
=
arel_from
.
from
(
arel_table
.
project
(
Arel
.
sql
(
'*'
)).
order
(
arel_table
[
column_sym
]).
as
(
arel_table
.
table_name
))
.
from
(
arel_table
.
project
(
Arel
.
sql
(
'*'
)).
order
(
arel_table
[
column_sym
]).
as
(
arel_table
.
table_name
))
.
project
(
average
([
arel_table
[
column_sym
]],
'median'
))
.
project
(
average
([
arel_table
[
column_sym
]],
'median'
))
.
where
(
.
where
(
...
...
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