Class: Gitlab::BackgroundMigration::BackfillJiraTrackerDeploymentType2

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/background_migration/backfill_jira_tracker_deployment_type2.rb

Overview

Backfill the deployment_type in jira_tracker_data table

Defined Under Namespace

Classes: JiraServiceTemp, JiraTrackerDataTemp

Instance Method Summary collapse

Instance Method Details

#perform(start_id, stop_id) ⇒ Object


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/gitlab/background_migration/backfill_jira_tracker_deployment_type2.rb', line 34

def perform(start_id, stop_id)
  @server_ids = []
  @cloud_ids  = []

  JiraTrackerDataTemp
    .where(id: start_id..stop_id, deployment_type: 0)
    .each do |jira_tracker_data|
      collect_deployment_type(jira_tracker_data)
    end

  unless cloud_ids.empty?
    JiraTrackerDataTemp.where(id: cloud_ids)
      .update_all(deployment_type: JiraTrackerDataTemp.deployment_types[:cloud])
  end

  unless server_ids.empty?
    JiraTrackerDataTemp.where(id: server_ids)
      .update_all(deployment_type: JiraTrackerDataTemp.deployment_types[:server])
  end

  mark_jobs_as_succeeded(start_id, stop_id)
end