Commit ce69663b authored by Yorick Peterse's avatar Yorick Peterse

Merge branch 'rails5-fix-mysql-arel-from' into 'master'

Rails5 fix arel from in mysql_median_datetime_sql

See merge request gitlab-org/gitlab-ce!20167
parents 4830c0c7 faf94535
---
title: Rails5 fix arel from in mysql_median_datetime_sql
merge_request: 20167
author: Jasper Maes
type: fixed
...@@ -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(
......
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