DBML — event sourcing skeleton
Aggregate, events, and snapshot tables.
Make it your own.
Table aggregates {
id uuid [pk]
type varchar
version int
}
Table events {
id bigint [pk, increment]
aggregate_id uuid [ref: > aggregates.id]
version int
type varchar
payload jsonb
occurred_at timestamp
}
Table snapshots {
aggregate_id uuid [pk, ref: > aggregates.id]
version int
state jsonb
taken_at timestamp
}