diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-14 12:08:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-14 12:08:45 +0300 |
commit | 6f9218ac84f0de0ebfddf2d4fbd79db881b2d46a (patch) | |
tree | 77315600c53ab077c7effd3ddf3f630dff6ea081 /lib/gitlab/background_migration | |
parent | 3612694ce3931fe7fd225d9c2df42dbd513121df (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/background_migration')
-rw-r--r-- | lib/gitlab/background_migration/backfill_prepared_at_merge_requests.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/gitlab/background_migration/backfill_prepared_at_merge_requests.rb b/lib/gitlab/background_migration/backfill_prepared_at_merge_requests.rb new file mode 100644 index 00000000000..9bf503bd6e7 --- /dev/null +++ b/lib/gitlab/background_migration/backfill_prepared_at_merge_requests.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Gitlab + module BackgroundMigration + # Backfill prepared_at for an array of merge requests + class BackfillPreparedAtMergeRequests < ::Gitlab::BackgroundMigration::BatchedMigrationJob + scope_to ->(relation) { relation } + operation_name :update_all + feature_category :code_review_workflow + + def perform + each_sub_batch do |sub_batch| + sub_batch.where(prepared_at: nil).where.not(merge_status: 'preparing').update_all('prepared_at = created_at') + end + end + end + end +end |