Files
discourse/migrations/lib/converters/example/steps/step3.rb
Gerhard Schlager 71a90dcba2 DEV: Refactor migrations-tooling
* Updates GitHub Action for migrations
* Rubocop: Always `EnforcedShorthandSyntax` for hashes in the `migrations` directory
* Automatically load all available converter steps
* Enable YJIT at runtime, if available
* Progressbar shows skipped records and other small improvements
2025-04-07 17:22:36 +02:00

24 lines
510 B
Ruby

# frozen_string_literal: true
module Migrations::Converters::Example
class Step3 < ::Migrations::Converters::Base::ProgressStep
run_in_parallel true
def max_progress
1000
end
def items
(1..1000).map { |i| { counter: i } }
end
def process_item(item)
sleep(0.5)
step.log_warning("Test", details: item) if item[:counter] > 10 && item[:counter] < 20
IntermediateDB::LogEntry.create(type: "info", message: "Step3 - #{item[:counter]}")
end
end
end