Merge pull request #4349 from okriuchykhin/ok_SCI_7092

Improve speed of step orderable elements migration [SCI-7092]
This commit is contained in:
Miha Mencin 2022-08-16 10:36:50 +02:00 committed by GitHub
commit df522e3b6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,7 +5,7 @@ class GenerateStepOrderableRelation < ActiveRecord::Migration[6.1]
include DatabaseHelper
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|
position = 0
orderable_elements = []