3 ms·
The pain of database migrations is what originally pushed me towards event sourcing. The database is read-only (but immediately mirrors changes applied to the e
by victorNicollet 3y ago
The pain of database migrations is what originally pushed me towards event sourcing. The database is read-only (but immediately mirrors changes applied to the event stream), and I can have multiple databases connected to the same stream, with different schemas.
This makes schema changes easy to perform (just create a new database and let the system populate it from the events), easy to do without downtime (keep the old database available while the new database is building), and easy to roll back (keep the old database available for a while after the migration).
The trade-off is that changing/adding event types now needs to be done carefully (first deploy code able to process the new event types, then deploy the code that can produce the new events), whereas a SQL database supports new UPDATE or INSERT without a schema change.
- gregw2 3y agoThis assumes your stream has the full event history … or that history/state is irrelevant, correct? If not, did you leave out a ‘copy history from source to target’ step?
- victorNicollet 3y agoIndeed, the event stream contains the full history of all events that have ever been produced during the lifetime of the application.