feat(data-safety): scheduled DB backups + audit trail + verified actor attribution
- db-backup sidecar: pg_dump -Fc of procurement+casdoor every BACKUP_INTERVAL_SECONDS into BACKUP_DIR, retention via BACKUP_KEEP_DAYS - audit_log table (migration.sql + runtime ensure_audit_table) with model + transactional helper (utils/audit.record) — wired into user create/role-change and inventory transaction creation - get_actor: quote_events.actor now stores the VERIFIED user's display name instead of the raw bearer token
This commit is contained in:
@@ -634,4 +634,15 @@ CREATE TRIGGER trg_item_decisions_sync_price
|
||||
-- double-applied. Arrival auto-posting (POST /pm/receipts) goes through
|
||||
-- the same service path and is idempotent via receipt_allocation_id.
|
||||
|
||||
-- ---------- AUDIT LOG (general activity trail, v2.7) ----------
|
||||
CREATE TABLE IF NOT EXISTS audit_log (
|
||||
id UUID NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
|
||||
occurred_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
actor TEXT,
|
||||
action TEXT NOT NULL,
|
||||
entity TEXT NOT NULL,
|
||||
entity_id TEXT,
|
||||
details JSONB NOT NULL DEFAULT '{}'
|
||||
);
|
||||
|
||||
COMMIT;
|
||||
|
||||
Reference in New Issue
Block a user