Replies: 9 comments
-
If you need to support your own table structure (i.e. adding additional columns and behaviour around that) going with custom repository is the best. There is a set of shared examples we run against repositories (active_record, in-memory, rom): https://github.com/RailsEventStore/rails_event_store/blob/master/ruby_event_store/lib/ruby_event_store/spec/event_repository_lint.rb. Those are distributed with require 'ruby_event_store/spec/event_repository_lint'
RSpec.describe MyRepository do
include_examples :event_repository
end |
Beta Was this translation helpful? Give feedback.
-
Maybe a viable alternative could be to have separate event tables per tenant? |
Beta Was this translation helpful? Give feedback.
-
I'd love to know which ruby event store version are you on! |
Beta Was this translation helpful? Give feedback.
-
btw. we're looking for ROM repository contributor — #834 |
Beta Was this translation helpful? Give feedback.
-
Hi, i will discuss this internally here about becoming a ROM repository contributor related to RES. Our use case is without using rails at all so we cannot use anything rails or active record specific. So i guess making a custom repository is what we will need todo eventually. I will need to look into the event store implementation a bit deeper to see what needs to be changed and how it can be maintained. |
Beta Was this translation helpful? Give feedback.
-
We are on 1.1.1 |
Beta Was this translation helpful? Give feedback.
-
It's been a while since this question. We are on the current RES version (2.5.1). Is a custom repository still the best way to amend the events and streams table? |
Beta Was this translation helpful? Give feedback.
-
It is probably the best way if you intend to drastically change events and steams table. As long as the repository API is preserved you can have any underlying structure and code in custom repository that supports this API. Somewhere in middle there's an option to pass your own ActiveRecord model classes to repository instance. Perhaps in your usecase that will be enough: When you only have additional columns in the tables, that are not used by RES, you probably don't have to do anything. I'm curious what's your usecase! |
Beta Was this translation helpful? Give feedback.
-
This is (kinda) what I'm trying to do. I just want to add an additional column (an aggregate id) to every event. Because the whole pipeline maps everything to I went pretty far deep down the rabbit hole so it seems the only way to achieve this is to write a completely new repository and I'm starting to think it would be better to just change the stream name to something like |
Beta Was this translation helpful? Give feedback.
-
Hi,
Maybe an obvious question to answer but would one add an additional column to the event_store_events and event_store_events_in_streams tables?
We are currently using ruby event store with rom and i am aware of custom mapper and serialise logic (https://railseventstore.org/docs/v1/mapping_serialization/) but i cannot accomplish my goal with that. We have a multitenant app and i want to be able to separate events per tenant using an additional column (tenant_id). I guess i would need to write my own repository implementation todo that (like described here: https://railseventstore.org/docs/v1/repository/)? Or is there something i am missing and could use todo this easily without monkeypatching the rom repository.
Beta Was this translation helpful? Give feedback.
All reactions