Class: Gitlab::BackgroundMigration::BackfillDesignManagementRepositories
- Inherits:
-
BatchedMigrationJob
- Object
- BatchedMigrationJob
- Gitlab::BackgroundMigration::BackfillDesignManagementRepositories
- Defined in:
- lib/gitlab/background_migration/backfill_design_management_repositories.rb
Overview
Backfill design_management_repositories table for a range of projects
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
#backfill_design_management_repositories(relation) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gitlab/background_migration/backfill_design_management_repositories.rb', line 16 def backfill_design_management_repositories(relation) connection.execute( <<~SQL INSERT INTO design_management_repositories (project_id, created_at, updated_at) SELECT projects.id, now(), now() FROM projects WHERE projects.id IN(#{relation.select(:id).to_sql}) ON CONFLICT (project_id) DO NOTHING; SQL ) end |
#perform ⇒ Object
10 11 12 13 14 |
# File 'lib/gitlab/background_migration/backfill_design_management_repositories.rb', line 10 def perform each_sub_batch do |sub_batch| backfill_design_management_repositories(sub_batch) end end |