You can look at the architecture of CQRS + Event Sourcing
. Instead of storing the state of the entity, store what had happened to her events. Negativ these events in turn in essence you can always get the state of the entity at any time.
Simplifies working with data entry in store, but complicated to read. So usually even use CQRS with two repositories, one for the record where is stored the sequence of events, the other for reading, which stores the current state of the entity. WriteModel broker sends a message about the event, ReadModel catches this message and updates its state in the database. ReadModel can always be recompiled from scratch on the existing events. You can use the denormalize your data and write to the database to read required data using simple queries.
The database can take any, though usually for ReadModel use standard relational or document-oriented, and for WriteModel, you can get something more specialized, such as event store
, simply because all the chips RDBMS for this part of the application are required.
You can see examples of implementing event sourcing https://github.com/prooph/event-sourcing