Class: Gitlab::BackgroundMigration::MigrateStageStatus
- Inherits:
-
Object
- Object
- Gitlab::BackgroundMigration::MigrateStageStatus
- Defined in:
- lib/gitlab/background_migration/migrate_stage_status.rb
Defined Under Namespace
Classes: Build
Constant Summary collapse
- STATUSES =
{ created: 0, pending: 1, running: 2, success: 3, failed: 4, canceled: 5, skipped: 6, manual: 7 }.freeze
Instance Method Summary collapse
Instance Method Details
#perform(start_id, stop_id) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/gitlab/background_migration/migrate_stage_status.rb', line 65 def perform(start_id, stop_id) status_sql = Build .where('ci_builds.commit_id = ci_stages.pipeline_id') .where('ci_builds.stage = ci_stages.name') .status_sql sql = <<-SQL UPDATE ci_stages SET status = (#{status_sql}) WHERE ci_stages.status IS NULL AND ci_stages.id BETWEEN #{start_id.to_i} AND #{stop_id.to_i} SQL ActiveRecord::Base.connection.execute(sql) end |