Merge pull request #9516 from opf/fix/env_var_on_aggregate_journal_migration

env var for aggregate journal migration batch size
pull/9515/head
Markus Kahl 3 years ago committed by GitHub
commit d091c91f4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      db/migrate/20210615150558_aggregate_journals.rb

@ -25,7 +25,7 @@ class AggregateJournals < ActiveRecord::Migration[6.1]
# The change is irreversible (aggregated journals cannot be broken down) but down will not cause database inconsistencies.
def aggregate_journals(klass)
klass.in_batches do |instances|
klass.in_batches(of: ENV["OPENPROJECT_MIGRATION_AGGREGATE_JOURNALS_BATCH_SIZE"]&.to_i || 1000) do |instances|
# Instantiating is faster than calculating the aggregated journals multiple times.
aggregated_journals = aggregated_journals_of(klass, instances).to_a

Loading…
Cancel
Save