I'm currently trying to understand how to build the internal structure of an event store. What I got so far:
- An event store has two tables (collections, ...), one for aggregates and one for events.
- The aggregates table contains the following data:
aggregateId(which will probably be a GUID) and theaggregateVersion(which is an integer that simply represents the number of the last event that influenced this aggregate). - The events table contains the following data:
eventId(again, a GUID),aggregateId(which the event belongs to),payload, and aversion(which is simply an integer that describes the order of the events).
Is this correct so far? Should events be ordered by using an integer? Or should they be ordered based on a timestamp? What are the advantages of each? What are the disadvantages?