Improve speed of step orderable elements migration [SCI-7092]

This commit is contained in:
Oleksii Kriuchykhin 2022-08-11 15:36:48 +02:00
parent 92adc43d42
commit f5178fdd92

View file

@ -5,7 +5,7 @@ class GenerateStepOrderableRelation < ActiveRecord::Migration[6.1]
include DatabaseHelper include DatabaseHelper
def up def up
Step.find_in_batches(batch_size: 100) do |steps| Step.preload(:step_texts, :step_tables, :checklists).find_in_batches(batch_size: 100) do |steps|
steps.each do |step| steps.each do |step|
position = 0 position = 0
orderable_elements = [] orderable_elements = []