Skip to content

eventually-postgres: Overhaul after v0.4.0 breaking changes #86

@ar3s3ru

Description

@ar3s3ru

The current state of eventually-postgres is pretty bad, being disabled after #81 has been merged.

Things that are currently missing in the crate:

Schema for Aggregates and Events

The database should potentially support a multi-Aggregate setup, so the proposed tables layout looks like this:

Aggregate Types

Contains all the Aggregate types definition in a centralized place.

Column Name Description
id Type identifier of the Aggregate -- might use type_name
offset Global offset of the $all stream.

Aggregates

Contains all the Aggregates created by the application.

Column Name Description
id Aggregate ID -- should be unique and a string.
aggregate_type_id Reference to the aggregate_types table. Useful for accessing the Aggregate Type offset.
version Last version of the Aggregate.

Events

Column Name Description
aggregate_id Reference to the aggregates table.
version Version of the Event, for Optimistic Concurrency.
sequence_number Value of the Global Offset at the time of insert -- useful for $all streams publishing idempotency.
event Contents of the event -- should be a JSON.

Notes

  • (aggregate_id, version) should be unique.

Metadata

Metadata

Assignees

No one assigned

    Labels

    eventually-postgresIssue or Pull Request involves eventually-util cratefeatureNew feature or requestrfcRequires more input or proposal stabilization

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions