diff options
author | Jasper Maes <jaspermaes.jm@gmail.com> | 2018-06-02 01:52:15 +0200 |
---|---|---|
committer | Jasper Maes <jaspermaes.jm@gmail.com> | 2018-06-02 15:00:51 +0200 |
commit | a91999e4faddbb5f5fc8e38548f4544ba6a41adf (patch) | |
tree | d9c5f104378bb7d9f8c8e5253a8b648b81b254df | |
parent | f8bd8f4f062e518ab855a83f38965df51ec3b073 (diff) | |
download | gitlab-ce-a91999e4faddbb5f5fc8e38548f4544ba6a41adf.tar.gz |
Rails5 Fix arel from
-rw-r--r-- | changelogs/unreleased/rails5-fix-46281.yml | 5 | ||||
-rw-r--r-- | lib/gitlab/database/median.rb | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/changelogs/unreleased/rails5-fix-46281.yml b/changelogs/unreleased/rails5-fix-46281.yml new file mode 100644 index 00000000000..ee0b8531988 --- /dev/null +++ b/changelogs/unreleased/rails5-fix-46281.yml @@ -0,0 +1,5 @@ +--- +title: Rails5 fix arel from +merge_request: 19340 +author: Jasper Maes +type: fixed diff --git a/lib/gitlab/database/median.rb b/lib/gitlab/database/median.rb index 74fed447289..3cac007a42c 100644 --- a/lib/gitlab/database/median.rb +++ b/lib/gitlab/database/median.rb @@ -143,8 +143,13 @@ module Gitlab .order(arel_table[column_sym]) ).as('row_id') - count = arel_table.from(arel_table.alias) - .project('COUNT(*)') + arel_from = if Gitlab.rails5? + arel_table.from.from(arel_table.alias) + else + arel_table.from(arel_table.alias) + end + + count = arel_from.project('COUNT(*)') .where(arel_table[partition_column].eq(arel_table.alias[partition_column])) .as('ct') |