Understanding event sourcing

The idea of event sourcing is a little different. Each change in the current state of your database would be a new event in a stream that only allows inclusion. Each update on the table would generate a new line, the change of status. If you have changed to an incorrect status, a new line would be generated by correcting this status. So, we'd have all the changes until you reach the current time of permission for the user.

From the beginning, in the status_user table using the concept of event sourcing, the records would be as follows:

ID

user_name

status

user_manager

1

John Doe

admin

Manager1

1

John Doe

normal_user

Manager2

 

If a new status change is applied to the user John ...

Get Microservice Patterns and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.