summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-05-31 20:46:19 +0000
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-05-31 20:46:19 +0000
commit3e4862ac6d492807a0b2a6ba3dde819716dbfae1 (patch)
treea07f2c9b4f40afd7ab3b17256001f61d63b43ab5 /lib
parent523ed2e72962e97be2603ab78aa13b372da582fa (diff)
parentf3efec202986f820eaa1dc76db34b095e73a99f6 (diff)
downloadgitlab-ce-3e4862ac6d492807a0b2a6ba3dde819716dbfae1.tar.gz
Merge branch 'osw-reset-merge-status-from-mergeable-mrs' into 'master'
Reset merge status from mergeable MRs See merge request gitlab-org/gitlab-ce!28843
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/background_migration/reset_merge_status.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/gitlab/background_migration/reset_merge_status.rb b/lib/gitlab/background_migration/reset_merge_status.rb
new file mode 100644
index 00000000000..447fec8903c
--- /dev/null
+++ b/lib/gitlab/background_migration/reset_merge_status.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module BackgroundMigration
+ # Updates the range of given MRs to merge_status "unchecked", if they're opened
+ # and mergeable.
+ class ResetMergeStatus
+ def perform(from_id, to_id)
+ relation = MergeRequest.where(id: from_id..to_id,
+ state: 'opened',
+ merge_status: 'can_be_merged')
+
+ relation.update_all(merge_status: 'unchecked')
+ end
+ end
+ end
+end