summaryrefslogtreecommitdiff
path: root/lib/gitlab/background_migration/batching_strategies/backfill_issue_work_item_type_batching_strategy.rb
blob: 7d5fef67c25a0d540a1bb9599f14351f41ffd905 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

module Gitlab
  module BackgroundMigration
    module BatchingStrategies
      # Batching class to use for back-filling issue's work_item_type_id for a single issue type.
      # Batches will be scoped to records where the foreign key is NULL and only of a given issue type
      #
      # If no more batches exist in the table, returns nil.
      class BackfillIssueWorkItemTypeBatchingStrategy < PrimaryKeyBatchingStrategy
        def apply_additional_filters(relation, job_arguments:, job_class: nil)
          issue_type = job_arguments.first

          relation.where(issue_type: issue_type)
        end
      end
    end
  end
end