Giao diện
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ột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
occurred_at | timestamptz | NOT NULL | ||
recorded_at | timestamptz | NOT NULL | ||
actor_account_id | uuid | FK → accounts | ||
actor_app | app_code | |||
actor_roles | text[] | NOT NULL | ||
session_id | uuid | |||
request_id | text | |||
correlation_id | correlation_ref | NOT NULL | ||
action | text | NOT NULL | ||
resource_type | text | NOT NULL | ||
resource_id | text | |||
result | text | NOT NULL | ||
reason | text | |||
before | jsonb | |||
after | jsonb | |||
metadata | jsonb | NOT NULL | ||
operation | text | P1-08. GraphQL Mutation field that produced the row; null for SQL-written auth/RBAC events. | ||
category | text | |||
resource_ids | text[] | NOT NULL | P1-08. All target ids of the action; resource_id is the first one. | |
resource_version | bigint | P1-08. Aggregate version after the committed command; null for denials and versionless events. | ||
client_ip | inet | |||
user_agent | text |
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ột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
audit_event_id | uuid | NOT NULL | PK FK → audit_events | |
recorded_at | timestamptz | NOT NULL | ||
before | jsonb | CV3-P4-02. Full masked before; null = not cut (the audit row holds it whole). | ||
after | jsonb | |||
before_bytes | integer | |||
after_bytes | integer | |||
complete | boolean | NOT NULL | CV3-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ó