Wiki source code of Audit Trail ERD Mermaid

Last modified by Robert Schaub on 2025/12/24 21:53

Show last authors
1 {{mermaid}}
2 erDiagram
3 USERS ||--o{ EDITS : makes
4 CLAIMS ||--o{ EDITS : tracks
5 EVIDENCE ||--o{ EDITS : tracks
6 SOURCES ||--o{ EDITS : tracks
7 SCENARIO ||--o{ EDITS : tracks
8 USERS {
9 uuid id PK
10 text name
11 text email
12 }
13 CLAIMS {
14 uuid id PK
15 text text
16 }
17 EVIDENCE {
18 uuid id PK
19 uuid claim_id FK
20 }
21 SOURCES {
22 uuid id PK
23 text name
24 }
25 SCENARIO {
26 uuid id PK
27 uuid claim_id FK
28 }
29 EDITS {
30 uuid id PK
31 text entity_type "claim|evidence|source|scenario|user"
32 uuid entity_id "FK to edited entity"
33 uuid user_id FK "NULL for AKEL"
34 text change_type "create|update|delete|moderate"
35 boolean is_automated "true for AKEL edits"
36 jsonb changes "before/after values"
37 text reason "explanation"
38 timestamp created_at
39 }
40 {{/mermaid}}
41
42 **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>>FactHarbor.Specification.Data Model.WebHome]] for two-tier edit history architecture (hot/cold storage).