UserTokens table
The UserTokens table in the FitStack - V2 schema has 19 columns, keyed by Id, with 1 foreign key to Users. 1 column in TokenEvents references it.
AggregateRoot, not Auditable — `LastModifiedAt`, and no soft delete. Rows are only ever status-flipped to Revoked, never deleted, and no cleanup job exists — the table grows without bound per user. Never eager-load this collection off Users.
Columns (19)
| Column | Type | Constraints | Description |
|---|---|---|---|
| Id | uuid | primary key, not null | ValueGeneratedNever — assigned by the domain. |
| UserId | character varying(450) | not null, references Users.Id | Delete behavior RESTRICT — a user with live tokens cannot be hard-deleted. |
| JwtId | character varying(128) | not null | |
| Status | character varying(50) | not null | `TokenStatus` as TEXT. |
| RevokedAt | timestamp with time zone | ||
| RevokedReason | character varying(500) | ||
| LastUsedAt | timestamp with time zone | ||
| UseCount | integer | not null | |
| TokenValue | character varying(2048) | not null | Owned Token VO. |
| TokenType | character varying(50) | not null | Owned Token VO. |
| TokenIssuedAt | timestamp with time zone | not null | Owned Token VO. |
| TokenExpiresAt | timestamp with time zone | not null | Owned Token VO. |
| MetadataIpAddress | character varying(45) | Owned TokenMetadata VO. | |
| MetadataUserAgent | character varying(512) | Owned TokenMetadata VO. | |
| MetadataDeviceId | character varying(128) | Owned TokenMetadata VO. | |
| MetadataCustomClaims | character varying(4000) | Owned TokenMetadata VO, JSON. | |
| Version | integer | not null | |
| CreatedAt | timestamp with time zone | not null | |
| LastModifiedAt | timestamp with time zone |
Indexes (4)
(TokenValue)unique (IX_UserTokens_TokenValue)(UserId)(IX_UserTokens_UserId)(JwtId)(IX_UserTokens_JwtId)(UserId, Status)(IX_UserTokens_UserId_Status)
Relationships
UserTokens.UserIdreferencesUsers.IdTokenEvents.TokenIdreferencesUserTokens