Welcome to mirror list, hosted at ThFree Co, Russian Federation.

backfill_uuid_conversion_column_in_vulnerability_occurrences.rb « background_migration « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4dccd3fd852d4d2ac214510b0cb900db8a5f184d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module Gitlab
  module BackgroundMigration
    # This batched background migration will backfill values for `uuid_convert_string_to_uuid` column in
    # vulnerability_occurrences table to allow us to migrate the column type from `varchar(36)` to `uuid`
    class BackfillUuidConversionColumnInVulnerabilityOccurrences < BatchedMigrationJob
      operation_name :backfill_uuid_conversion_column_in_vulnerability_occurrences
      scope_to ->(relation) do
        relation.where("uuid_convert_string_to_uuid = '00000000-0000-0000-0000-000000000000'::uuid")
      end
      feature_category :vulnerability_management

      def perform
        each_sub_batch do |sub_batch|
          sub_batch.update_all("uuid_convert_string_to_uuid = uuid::uuid")
        end
      end
    end
  end
end