Rails5 fix arel from in mysql_median_datetime_sql
This commit is contained in:
parent
0139c221e4
commit
faf94535fb
2 changed files with 12 additions and 1 deletions
5
changelogs/unreleased/rails5-fix-mysql-arel-from.yml
Normal file
5
changelogs/unreleased/rails5-fix-mysql-arel-from.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Rails5 fix arel from in mysql_median_datetime_sql
|
||||
merge_request: 20167
|
||||
author: Jasper Maes
|
||||
type: fixed
|
|
@ -33,7 +33,13 @@ module Gitlab
|
|||
end
|
||||
|
||||
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))
|
||||
.project(average([arel_table[column_sym]], 'median'))
|
||||
.where(
|
||||
|
|
Loading…
Reference in a new issue