summaryrefslogtreecommitdiff
path: root/app/models/deployment.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-31 21:06:28 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-31 21:06:28 +0000
commit8f210aebe1d740e8ee194f171f1f33a6e1fba313 (patch)
treef43c545801bb96fd0737f18493fb30ab92972627 /app/models/deployment.rb
parent996f700997805b3590da8d8afdd19d193989078a (diff)
downloadgitlab-ce-8f210aebe1d740e8ee194f171f1f33a6e1fba313.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/deployment.rb')
-rw-r--r--app/models/deployment.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/deployment.rb b/app/models/deployment.rb
index 7ccd5e98360..698988e9295 100644
--- a/app/models/deployment.rb
+++ b/app/models/deployment.rb
@@ -75,6 +75,11 @@ class Deployment < ApplicationRecord
find(ids)
end
+ def self.distinct_on_environment
+ order('environment_id, deployments.id DESC')
+ .select('DISTINCT ON (environment_id) deployments.*')
+ end
+
def self.find_successful_deployment!(iid)
success.find_by!(iid: iid)
end