BigW Consortium Gitlab

Commit 5292eb65 by Grzegorz Bizon

Schedule background migration only when it is needed

parent 02bb40e2
......@@ -12,7 +12,9 @@ class MigrateStageIdReferenceInBackground < ActiveRecord::Migration
end
def up
Build.find_in_batches(batch_size: BATCH_SIZE).with_index do |builds, batch|
Build.where(stage_id: nil)
.find_in_batches(batch_size: BATCH_SIZE)
.with_index do |builds, batch|
migrations = builds.map { |build| [MIGRATION, [build.id]] }
BackgroundMigrationWorker.perform_bulk(*migrations)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment