Skip to content

The search box knows all the secrets -- try it!

Polecat is part of the Critter Stack ecosystem.

JasperFx Logo JasperFx provides formal support for Polecat and other Critter Stack libraries. Please check our Support Plans for more details.

Event Storage

Polecat stores events in SQL Server 2025 using three core tables.

pc_events

The main event log table:

ColumnTypeDescription
seq_idbigint IDENTITY(1,1)Global sequence number (PK)
iduniqueidentifierUnique event ID
stream_iduniqueidentifier or nvarchar(250)Stream identifier
versionintPosition within the stream
datajsonSerialized event body
typenvarchar(250)Event type name (snake_case)
timestampdatetimeoffsetWhen the event was recorded
tenant_idnvarchar(250)Tenant identifier
dotnet_typenvarchar(500)Full .NET type name
correlation_idnvarchar(250)Request correlation
causation_idnvarchar(250)Event causation chain
headersjsonCustom metadata headers
is_archivedbitArchive flag

pc_streams

Stream metadata:

ColumnTypeDescription
iduniqueidentifier or nvarchar(250)Stream identifier (PK)
typenvarchar(250)Aggregate type name
versionintCurrent stream version
timestampdatetimeoffsetLast event timestamp
createddatetimeoffsetStream creation time
snapshotjsonLatest snapshot data
snapshot_versionintSnapshot version
tenant_idnvarchar(250)Tenant identifier
is_archivedbitArchive flag

pc_event_progression

Async daemon progress tracking:

ColumnTypeDescription
namenvarchar(250)Projection/subscription name (PK)
last_seq_idbigintLast processed sequence ID
last_updateddatetimeoffsetLast update timestamp

Event Type Naming

Polecat converts .NET event type names to snake_case for storage:

  • QuestStartedquest_started
  • MembersJoinedmembers_joined
  • InvoiceLineItemAddedinvoice_line_item_added

Sequence IDs

Events are assigned a global, monotonically increasing sequence ID via SQL Server's IDENTITY(1,1). This provides a total ordering of all events across all streams, which is critical for the async daemon's event processing.

JSON Storage

Event data and headers are stored using SQL Server 2025's native json type, serialized with System.Text.Json.

Released under the MIT License.