Audit Trail ERD

Last modified by Robert Schaub on 2025/12/24 09:59

Audit Trail ERD

This diagram shows how changes to all entities are tracked through the EDITS table.

erDiagram
 USERS ||--o{ EDITS : makes
 CLAIMS ||--o{ EDITS : tracks
 EVIDENCE ||--o{ EDITS : tracks
 SOURCES ||--o{ EDITS : tracks
 SCENARIO ||--o{ EDITS : tracks
 USERS {
 uuid id PK
 text name
 text email
 }
 CLAIMS {
 uuid id PK
 text text
 }
 EVIDENCE {
 uuid id PK
 uuid claim_id FK
 }
 SOURCES {
 uuid id PK
 text name
 }
 SCENARIO {
 uuid id PK
 uuid claim_id FK
 }
 EDITS {
 uuid id PK
 text entity_type "claim|evidence|source|scenario|user"
 uuid entity_id "FK to edited entity"
 uuid user_id FK "NULL for AKEL"
 text change_type "create|update|delete|moderate"
 boolean is_automated "true for AKEL edits"
 jsonb changes "before/after values"
 text reason "explanation"
 timestamp created_at
 }

Audit Trail ERD - Shows how all changes are tracked. Every significant change to Claims, Evidence, Sources, or Scenarios creates an Edit record. Edits track who made the change (user_id, NULL for AKEL), what changed (before/after in JSONB), when (created_at), and why (reason). The is_automated flag distinguishes human edits from AKEL updates. This is the "hot" audit trail stored in PostgreSQL. See Data Model for two-tier edit history architecture (hot/cold storage).


See also: