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

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

module Gitlab
  module BackgroundMigration
    # Backfills the users table columns with their default values
    class BackfillUsersWithDefaults < BatchedMigrationJob
      operation_name :backfill_users_with_defaults
      feature_category :user_profile

      def perform
        each_sub_batch do |sub_batch|
          connection.transaction do
            sub_batch.where(project_view: nil).update_all(project_view: 2)
            sub_batch.where(hide_no_ssh_key: nil).update_all(hide_no_ssh_key: false)
            sub_batch.where(hide_no_password: nil).update_all(hide_no_password: false)
            sub_batch.where(notified_of_own_activity: nil).update_all(notified_of_own_activity: false)
          end
        end
      end
    end
  end
end