We (Wolves) think the auto creation of the projector tracker table is dangerous and a little too magical. Recently we were tripped up during a data migration to a new AWS region, and restored the events db before the projections db. The app was unknowingly running at the time (because a deploy had (re)started it). The result of this was the app had already created the projector_tracker table at runtime setting the last_processed_event_id's to 0 for each event processor and when it noticed all the new events suddenly appear began replaying them all (together with side effects) - how rude...
We think the creation should be an explicit action as nobody is immune from brain farts.
This PR makes this behaviour configurable from the host application. Speaking to @stevehodgkiss about this weeks ago and he raised that the most controversial part of this was getting everyone to update their EventSourcery apps as it would be a breaking change. Therefore instead of introducing a breaking change, this first introduces a configurable default which gives other ES apps at Envato time to adapt and keeps the existing behaviour. We should probably get rid of this behaviour permanently however before we open source it.
Payables will introduce a new rake task so we can orchestrate its creation which will look something like
desc 'Create projector tracker'
task create_projector_tracker: :environment do
EventSourcery::EventProcessing::Postgres::Schema.create(db: Payables.projections_db)
end
I highly recommend that everyone makes the necessary changes to make this explicit. @stevehodgkiss mentioned it had also tripped him up in the past and trust me.. if it does, this will save you from having a mini heart attack 😱
We (Wolves) think the auto creation of the projector tracker table is dangerous and a little too magical. Recently we were tripped up during a data migration to a new AWS region, and restored the events db before the projections db. The app was unknowingly running at the time (because a deploy had (re)started it). The result of this was the app had already created the
projector_tracker
table at runtime setting thelast_processed_event_id
's to 0 for each event processor and when it noticed all the new events suddenly appear began replaying them all (together with side effects) - how rude...We think the creation should be an explicit action as nobody is immune from brain farts.
This PR makes this behaviour configurable from the host application. Speaking to @stevehodgkiss about this weeks ago and he raised that the most controversial part of this was getting everyone to update their EventSourcery apps as it would be a breaking change. Therefore instead of introducing a breaking change, this first introduces a configurable default which gives other ES apps at Envato time to adapt and keeps the existing behaviour. We should probably get rid of this behaviour permanently however before we open source it.
Payables will introduce a new rake task so we can orchestrate its creation which will look something like
I highly recommend that everyone makes the necessary changes to make this explicit. @stevehodgkiss mentioned it had also tripped him up in the past and trust me.. if it does, this will save you from having a mini heart attack 😱