summaryrefslogtreecommitdiff
path: root/app/models/deployment.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-03 18:07:40 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-03 18:07:40 +0000
commit5e7ed643dca39625fcc7b0d0e9e15550f5a9f1f8 (patch)
tree6a1d9d1fc3825e7fcaf4d688f96bc97954eaa904 /app/models/deployment.rb
parent511e761b41b81484c85e3d125f45873ce38e9201 (diff)
downloadgitlab-ce-5e7ed643dca39625fcc7b0d0e9e15550f5a9f1f8.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/deployment.rb')
-rw-r--r--app/models/deployment.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/deployment.rb b/app/models/deployment.rb
index 101f18f3886..5a22a6ada9d 100644
--- a/app/models/deployment.rb
+++ b/app/models/deployment.rb
@@ -212,10 +212,14 @@ class Deployment < ApplicationRecord
# We don't use `Gitlab::Database.bulk_insert` here so that we don't need to
# first pluck lots of IDs into memory.
+ #
+ # We also ignore any duplicates so this method can be called multiple times
+ # for the same deployment, only inserting any missing merge requests.
DeploymentMergeRequest.connection.execute(<<~SQL)
INSERT INTO #{DeploymentMergeRequest.table_name}
(merge_request_id, deployment_id)
#{select}
+ ON CONFLICT DO NOTHING
SQL
end