auth_identity


Description

{“what”:“One row per external login (e.g., Google) for a user.”,“why”:“Enables OAuth sign-in and account linking.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:02:27.257761327+00:00”}

Columns

Column Type Size Nulls Auto Default Children Parents Comments
id int4 10 √ null
core_session.auth_identity_id fk_session_auth_identity C

{“what”:“Surrogate key; unique identifier for each identity row.”,“why”:“Provides a stable reference for updates and joins.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:02:27.284593859+00:00”}

user_id int4 10 null
core_user.id fk_auth_identity_core_user_id C

{“what”:“Internal user account this identity belongs to.”,“why”:“Maps external login to the local user; without it, sign-in cannot resolve to an account.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:02:27.310663476+00:00”}

provider varchar 50 null

{“what”:“Authentication service name (e.g., ‘google’, ‘github’).”,“why”:“Distinguishes identities from different providers; needed to route OAuth flows.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:02:27.321821736+00:00”}

credentials text 2147483647 √ null

{“what”:“Opaque token or encrypted secret for the provider session.”,“why”:“Holds provider-specific auth material; without it, refresh or API calls fail.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:02:27.337788274+00:00”}

metadata text 2147483647 √ null

{“what”:“Provider-supplied profile data as JSON or serialized text.”,“why”:“Preserves user info (email, avatar) without extra API calls.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:02:27.355307567+00:00”}

provider_id varchar 255 √ null

{“what”:“Unique identifier for the user at the provider.”,“why”:“Matches incoming provider callbacks to this identity; prevents duplicate accounts.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:02:27.374893857+00:00”}

last_used_at timestamptz 35,6 √ null

{“what”:“Timestamp of the most recent successful authentication.”,“why”:“Supports session expiry and security audits; unknown usage patterns.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:02:27.393691515+00:00”}

expires_at timestamptz 35,6 √ null

{“what”:“Time when the provider token or session expires.”,“why”:“Triggers token refresh; without it, stale credentials cause auth failures.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:02:27.413316462+00:00”}

created_at timestamptz 35,6 null

{“what”:“Time the identity row was created.”,“why”:“Audit trail and ordering; needed for lifecycle management.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:02:27.427877049+00:00”}

updated_at timestamptz 35,6 null

{“what”:“Time the identity row was last modified.”,“why”:“Tracks changes to credentials or metadata; supports concurrency checks.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:02:27.445880038+00:00”}

Indexes

Constraint Name Type Sort Column(s)
auth_identity_pkey Primary key Asc id
idx_auth_identity_provider Performance Asc provider
idx_auth_identity_provider_id Performance Asc provider_id
idx_auth_identity_provider_provider_id Performance Asc/Asc provider + provider_id
idx_auth_identity_user_id Performance Asc user_id
unique_auth_identity_user_provider Must be unique Asc/Asc user_id + provider

Relationships