Before going directly onto the theme of event sourcing, it is necessary to understand the functioning of most standard applications.
Whenever we run the command UPDATE
in the database, we perform a modification to our current representation in the database. With that, whenever we do a query on the database, we seek the current state of a record. This behavior is called state mutation. Let's use an example to make it clearer.
Suppose we have a table responsible for administering the access level of a user. The table is composed as follows:
|
|
|
|
|
|
|
|
As we look at the preceding table, we see that the user John Doe
is an administrator and this status was applied by Manager1
. After a period of time, it was found that John Doe could never have been the admin of the application and an UPDATE
is performed on this row in the table:
UPDATE status_user set status='normal_user', user_manager='Manage2' WHERE ID=1;
This...