audit_logs table
The audit_logs table in the Reddit Clone Database Schema schema has 10 columns, keyed by id.
Append-only and write-once, capturing before and after values. This is the table an auditor actually asks for, and it is deliberately separate from mod_actions and admin_actions, which are product surfaces rather than a compliance record.
Columns (10)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| actor_type | actor_type | not null | |
| actor_id | uuid | ||
| action | varchar(80) | not null | |
| target_type | varchar(40) | not null | |
| target_id | uuid | ||
| before_json | text | ||
| after_json | text | ||
| ip_address | varchar(45) | ||
| created_at | timestamptz | not null |
Indexes (3)
(actor_type, actor_id, created_at)(target_type, target_id)(created_at)