Class: Gitlab::BackgroundMigration::BackfillVulnerabilityReadsClusterAgent
- Inherits:
-
BatchedMigrationJob
- Object
- BatchedMigrationJob
- Gitlab::BackgroundMigration::BackfillVulnerabilityReadsClusterAgent
- Defined in:
- lib/gitlab/background_migration/backfill_vulnerability_reads_cluster_agent.rb
Overview
Backfills the ‘vulnerability_reads.casted_cluster_agent_id` column
Constant Summary collapse
- CLUSTER_AGENTS_JOIN =
<<~SQL INNER JOIN cluster_agents ON CAST(vulnerability_reads.cluster_agent_id AS bigint) = cluster_agents.id AND vulnerability_reads.project_id = cluster_agents.project_id SQL
- CLUSTER_IMAGE_SCANNING_REPORT_TYPE =
7
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
#perform ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/gitlab/background_migration/backfill_vulnerability_reads_cluster_agent.rb', line 20 def perform each_sub_batch do |sub_batch| sub_batch .joins(CLUSTER_AGENTS_JOIN) .update_all('casted_cluster_agent_id = CAST(vulnerability_reads.cluster_agent_id AS bigint)') end end |