Mint entity identifiers as UUIDv7 via central ViegardId helper #14
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/uuidv7-ids"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What does this PR do?
Adopts D-0030: every entity identifier is now a version 7 UUID from
Guid.CreateVersion7(), minted exclusively through the newViegard.Domain.ViegardId.New()helper (all 17 formerGuid.NewGuid()sites converted), so the generation policy is one line to change forever after.Why: random v4 ids scatter inserts across the primary-key b-tree, causing page splits, full-page-write WAL amplification, and a large hot working set on exactly the tables that grow (events, classifications, audit). v7''s leading 48-bit millisecond timestamp keeps inserts on the rightmost leaves and gives the admin GUI an index-friendly keyset-pagination cursor. 62+ bits of randomness remain, so ids stay unguessable; rows already carry explicit timestamp columns, so the embedded timestamp leaks nothing new inside the trust boundary.
Constraints kept explicit in the helper doc and D-0030: id order is approximate only (per-generator clocks, no intra-millisecond guarantee); event ordering semantics always come from explicit timestamp fields. Existing v4 rows coexist harmlessly in the same
uuidcolumns; no schema change or migration.How was this tested?
dotnet build- 0 errors, 0 warningsdotnet test- 267 passed, 7 skipped (live-PostgreSQL integration tests; local WSL Docker unavailable)ViegardIdTests: version/variant fields, uniqueness across 10,000 mints, embedded timestamp is current, and later-minted ids sort later under PostgreSQL uuid byte orderChecklist