Skip to content

identity / audit ​

Trang sinh tự động

Sinh từ ad83b0aea — chạy 820 migration lên PostgreSQL 17 rồi đọc pg_catalog. Mô tả bảng và cột lấy từ COMMENT ON. Không sửa tay: lần chạy docgen sau sẽ ghi đè.

2 bảng. Quay lại identity.

audit_events ​

P1-01 table, P1-08 behaviour. APPEND_ONLY: update/delete/truncate rejected by ALWAYS triggers and granted to nobody; pi_api INSERT as the acting principal only; no actor SELECT (Z-01 GAP).

public.audit_events · 23 cột · 13 check · 0 unique · 10 index · 1 policy · 2 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
occurred_attimestamptzNOT NULL
recorded_attimestamptzNOT NULL
actor_account_iduuidFK → accounts
actor_appapp_code
actor_rolestext[]NOT NULL
session_iduuid
request_idtext
correlation_idcorrelation_refNOT NULL
actiontextNOT NULL
resource_typetextNOT NULL
resource_idtext
resulttextNOT NULL
reasontext
beforejsonb
afterjsonb
metadatajsonbNOT NULL
operationtextP1-08. GraphQL Mutation field that produced the row; null for SQL-written auth/RBAC events.
categorytext
resource_idstext[]NOT NULLP1-08. All target ids of the action; resource_id is the first one.
resource_versionbigintP1-08. Aggregate version after the committed command; null for denials and versionless events.
client_ipinet
user_agenttext

Khoá chính: id

Trỏ ra (1):

  • actor_account_id → accounts · ON DELETE RESTRICT

Được trỏ tới (1): audit_event_details

audit_event_details ​

CV3-P4-02 (DEC-CV3-20). Full masked before/after of an audit_events row the redact summary cut (metadata.hasDetail). APPEND_ONLY: update/delete/truncate rejected by ALWAYS triggers and granted to nobody; pi_api INSERT for the acting principal's own flagged row, SELECT with audit.read (Z-01).

public.audit_event_details · 7 cột · 7 check · 0 unique · 1 index · 2 policy · 2 trigger · RLS bật

CộtKiểuKhoáMô tả
audit_event_iduuidNOT NULLPK FK → audit_events
recorded_attimestamptzNOT NULL
beforejsonbCV3-P4-02. Full masked before; null = not cut (the audit row holds it whole).
afterjsonb
before_bytesinteger
after_bytesinteger
completebooleanNOT NULLCV3-P4-02. False when a side was over 4 MiB of JSON and keeps only {truncated, keys, bytes}.

Khoá chính: audit_event_id

Trỏ ra (1):

  • audit_event_id → audit_events · ON DELETE RESTRICT

Được trỏ tới: không có

Sinh từ ad83b0aea · 820 migration · PostgreSQL 17