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)

Columns of the audit_logs table
ColumnTypeConstraintsDescription
iduuidprimary key
actor_typeactor_typenot null
actor_iduuid
actionvarchar(80)not null
target_typevarchar(40)not null
target_iduuid
before_jsontext
after_jsontext
ip_addressvarchar(45)
created_attimestamptznot null

Indexes (3)

  • (actor_type, actor_id, created_at)
  • (target_type, target_id)
  • (created_at)