File size: 1,050 Bytes
a32af27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
-- Admin audit trail — every manual admin action (review decisions, source
-- toggles, poll runs), newest first. Mirrors DataWiz-Project's /admin/audit.
-- Automatic pipeline decisions (auto-publish, auto-discard) are NOT logged
-- here — they're already visible per-item in news_items.status, and logging
-- every one of them would make this table useless as a human-action trail.

create extension if not exists pgcrypto;

create table if not exists admin_audit_log (
  id         uuid primary key default gen_random_uuid(),
  at         timestamptz not null default now(),
  actor      text not null,   -- admin's Firebase UID
  kind       text not null check (kind in ('review', 'source', 'run')),
  action     text not null,   -- e.g. 'published', 'discarded', 'enabled', 'disabled', 'started'
  target     text,            -- the item/source/poll id this action was on
  summary    text not null    -- short human-readable description, e.g. the item title
);

create index if not exists admin_audit_log_at_idx on admin_audit_log (at desc);