Class: Karafka::Web::Management::Migrations::ConsumersReports::RenameProcessNameToId
- Inherits:
-
Base
- Object
- Base
- Karafka::Web::Management::Migrations::ConsumersReports::RenameProcessNameToId
- Defined in:
- lib/karafka/web/management/migrations/consumers_reports/1761645571_rename_process_name_to_id.rb
Overview
Migrates consumer reports from schema < 1.3.0 that used process[:name] to process[:id]
In schema versions 1.2.x and earlier (karafka-web <= v0.8.2), the process identifier was stored in the :name field. Starting with schema 1.3.0 (karafka-web v0.9.0+), this was renamed to :id for consistency.
This migration ensures old reports can be processed by current aggregators that expect the :id field.
Instance Method Summary collapse
Methods inherited from Base
applicable?, index, migrate, sorted_descendants
Instance Method Details
#migrate(report) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/karafka/web/management/migrations/consumers_reports/1761645571_rename_process_name_to_id.rb', line 23 def migrate(report) # If :id already exists, nothing to do (already migrated or newer schema) return if report[:process][:id] # Rename :name to :id # Both :name (in schema < 1.3.0) and :id (in schema >= 1.3.0) were always # required fields, so we don't need nil checks for valid reports report[:process][:id] = report[:process][:name] report[:process].delete(:name) end |