diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-06 06:08:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-06 06:08:02 +0300 |
commit | ed73d4f207ef6cb8646719baa1188d096c9f3139 (patch) | |
tree | dea7ab9906154c73204a0361163e30500f929d44 /app/models/upload.rb | |
parent | 2349eabc1a473bfb70555f0ce6d3d808cecb181d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/upload.rb')
-rw-r--r-- | app/models/upload.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/upload.rb b/app/models/upload.rb index 8c409641452..650321e2793 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -23,6 +23,21 @@ class Upload < ApplicationRecord after_destroy :delete_file!, if: -> { uploader_class <= FileUploader } class << self + def inner_join_local_uploads_projects + upload_table = Upload.arel_table + project_table = Project.arel_table + + join_statement = upload_table.project(upload_table[Arel.star]) + .join(project_table) + .on( + upload_table[:model_type].eq('Project') + .and(upload_table[:model_id].eq(project_table[:id])) + .and(upload_table[:store].eq(ObjectStorage::Store::LOCAL)) + ) + + joins(join_statement.join_sources) + end + ## # FastDestroyAll concerns def begin_fast_destroy |