blob: 73996ce4460b6af5bdbee2fbbaab86c56da1cd0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# frozen_string_literal: true
module Gitlab
module BackgroundMigration
class BackfillPartitionIdCiPipelineArtifact < BatchedMigrationJob
operation_name :update_all
feature_category :continuous_integration
def perform
return unless uses_multiple_partitions?
each_sub_batch do |sub_batch|
sub_batch
.where('ci_pipeline_artifacts.pipeline_id = ci_pipelines.id')
.update_all('partition_id = ci_pipelines.partition_id FROM ci_pipelines')
end
end
private
def uses_multiple_partitions?
!!connection.select_value(<<~SQL)
SELECT true FROM p_ci_builds WHERE partition_id = 101 LIMIT 1
SQL
end
end
end
end
|