You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: posts/2025-09-12-evolving-event-names-and-payloads-in-rails-event-store-without-breaking-history.md
+45-36Lines changed: 45 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -159,56 +159,65 @@ As described in [this post](https://blog.arkency.com/4-strategies-when-you-need-
159
159
160
160
After investigating its capabilities, we discovered that upcast can indeed handle both event class name changes and payload transformation through lambda functions. However, we chose to stick with our custom mapper approach for several practical reasons:
161
161
162
-
### Pipeline integration complexity
162
+
### Excessive boilerplate when using lambdas
163
+
164
+
Rails Event Store provides `Transformation::Upcast` which can handle both event class name changes and payload transformation through lambda functions. After investigating its capabilities, we chose to stick with our custom mapper approach for several practical reasons:
163
165
164
-
RES upcast works beautifully as a standalone solution, but doesn't integrate cleanly with the transformation pipeline we needed:
166
+
### Code organization and maintainability
167
+
168
+
While `Transformation::Upcast` is pipeline-compatible and would work with our transformation stack:
165
169
166
170
```ruby
167
-
# This doesn't work - Default mapper isn't pipeline-compatible
168
171
RubyEventStore::Mappers::PipelineMapper.new(
169
-
RubyEventStore::Mappers::Pipeline.new(
170
-
RubyEventStore::Mappers::Default.new(events_class_remapping:upcast_map),# No dump() method
We needed `DomainEvent.new`, `SymbolizeMetadataKeys.new`, and `PreserveTypes.new` transformations, but upcast's `Default` mapper isn't designed to work within a transformation pipeline.
178
-
179
-
### Excessive boilerplate when using lambdas
180
-
181
-
Lambdas could be used to handle paload transformation, however using upcast with lambdas required significant boilerplate code for each event type:
180
+
However, it would require significant boilerplate code for each event type:
0 commit comments