Files
Aether/backend/db/migrations/000010_audit_log.up.sql
HoneyandClaude Opus 5 31a027c93a feat(aether): initial commit – self-hosted Cloud, Phasen 1–7
Go-Backend (chi, pgx, golang-migrate) + React/TS-Frontend als PWA.
Enthalten: Auth inkl. OIDC, Dateien mit Versionen und Papierkorb,
Freigaben (Links + intern), WebDAV, Gruppenordner, Admin/Theming,
Volltextsuche mit OCR, eigener PDF-Betrachter und WOPI-Office
(Collabora/OnlyOffice).

Nicht im Repo: deploy/.env (Sitzungsschlüssel, DB- und Admin-Passwort)
sowie alle Daten- und Build-Verzeichnisse – siehe .gitignore.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-24 09:25:36 +02:00

28 lines
1.1 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- Audit-Log: wer hat was wann getan. Zweck ist die Nachvollziehbarkeit nach
-- einem Vorfall – deshalb muss ein Eintrag auch dann noch lesbar sein, wenn der
-- handelnde oder betroffene Account längst gelöscht ist.
CREATE TABLE audit_log (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- ON DELETE SET NULL statt CASCADE: sonst räumte das Löschen eines Users
-- genau die Spuren weg, die man danach untersuchen will.
actor_id UUID REFERENCES users(id) ON DELETE SET NULL,
-- Denormalisiert, damit der Name den gelöschten Account überlebt.
actor_name TEXT NOT NULL,
action TEXT NOT NULL,
target_type TEXT,
target_id TEXT,
target_name TEXT,
ip TEXT,
detail TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
-- Die Admin-Ansicht liest immer neueste zuerst, oft gefiltert nach Aktion oder
-- handelndem Konto.
CREATE INDEX idx_audit_log_created ON audit_log (created_at DESC);
CREATE INDEX idx_audit_log_actor ON audit_log (actor_id, created_at DESC);
CREATE INDEX idx_audit_log_action ON audit_log (action, created_at DESC);