Follow-up to #4.
The audit_log table and per-tenant organisations.audit_retention_days column (default 395) ship in #4, but the actual purge job is out of scope for that PR.
Scope
- Recurring job (Inngest / cron via
instrumentation.ts) that deletes audit_log rows where created_at < now() - organisations.audit_retention_days * interval '1 day', grouped per organisation.
- Run nightly (overnight AU). Surface per-org counts via structured logs.
- Respect retention overrides — never delete rows newer than the org's configured window.
- Test: create rows then advance retention boundary to confirm purge correctness.
Acceptance
- Job is registered and runs on the schedule.
- Deletion is batched (e.g. 10k rows per statement) so it does not lock the table.
- Operator-visible metric: rows purged per org per run.
Follow-up to #4.
The
audit_logtable and per-tenantorganisations.audit_retention_dayscolumn (default 395) ship in #4, but the actual purge job is out of scope for that PR.Scope
instrumentation.ts) that deletesaudit_logrows wherecreated_at < now() - organisations.audit_retention_days * interval '1 day', grouped per organisation.Acceptance