Class: Gitlab::BackgroundMigration::BackfillUserPreferencesWithDefaults

Inherits:
BatchedMigrationJob show all
Defined in:
lib/gitlab/background_migration/backfill_user_preferences_with_defaults.rb

Overview

Backfills the user_preferences table columns with their default values

Constant Summary

Constants inherited from BatchedMigrationJob

Gitlab::BackgroundMigration::BatchedMigrationJob::DEFAULT_FEATURE_CATEGORY

Constants included from Database::DynamicModelHelpers

Database::DynamicModelHelpers::BATCH_SIZE

Instance Method Summary collapse

Methods inherited from BatchedMigrationJob

#batch_metrics, feature_category, #filter_batch, generic_instance, #initialize, job_arguments, job_arguments_count, operation_name, scope_to

Methods included from Database::DynamicModelHelpers

#define_batchable_model, #each_batch, #each_batch_range

Constructor Details

This class inherits a constructor from Gitlab::BackgroundMigration::BatchedMigrationJob

Instance Method Details

#performObject



10
11
12
13
14
15
16
17
18
# File 'lib/gitlab/background_migration/backfill_user_preferences_with_defaults.rb', line 10

def perform
  each_sub_batch do |sub_batch|
    connection.transaction do
      sub_batch.where(tab_width: nil).update_all(tab_width: 8)
      sub_batch.where(time_display_relative: nil).update_all(time_display_relative: true)
      sub_batch.where(render_whitespace_in_code: nil).update_all(render_whitespace_in_code: false)
    end
  end
end