Finanzmanager/migrations/018_bank_protokolle.sql
fds2610-bot 3caf1dcdca Fix #67: Übermittlungsprotokoll für Überweisungen und Bankkommunikation speichern
Der gesamte FinTS-Dialog (gesendete und empfangene Meldungen) wird je Durchlauf
in bank_protokolle gespeichert, im Erfolgs- wie im Fehlerfall. Im Zahlungsverkehr
öffnet der Status das Protokoll der Überweisung als modalen Dialog; unter
Online-Banking › Protokoll gibt es das Gesamtprotokoll mit Filter nach Bank,
Datum und Freitext.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-21 07:48:10 +02:00

31 lines
1.6 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.

-- Übermittlungsprotokoll: jede Kommunikation mit einer Bank.
--
-- Zum Nachweis gegenüber der Bank, dass eine Überweisung fristgerecht und
-- korrekt übermittelt wurde, bleibt der gesamte Dialog stehen – die gesendeten
-- und die empfangenen Meldungen, im Erfolgs- wie im Fehlerfall. PIN und TAN
-- sind vor dem Speichern maskiert (siehe Services\BankProtokollLogger).
--
-- Ein Eintrag ist ein Durchlauf: Eine Überweisung mit TAN-Freigabe hat deshalb
-- mehrere. `auftrag_id` verbindet sie mit dem Zahlungsauftrag; die Verbindung
-- fällt weg, wenn der Auftrag gelöscht wird, das Protokoll selbst bleibt.
CREATE TABLE IF NOT EXISTS bank_protokolle (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
benutzer_id INT UNSIGNED NOT NULL,
zugang_id INT UNSIGNED NULL,
auftrag_id INT UNSIGNED NULL,
art ENUM('ueberweisung','abruf','verfahren') NOT NULL,
status ENUM('erfolg','fehler','offen') NOT NULL,
meldung TEXT NULL,
protokoll LONGTEXT NULL,
erstellt_am DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
KEY idx_protokoll_auftrag (auftrag_id),
KEY idx_protokoll_zugang (zugang_id, erstellt_am),
KEY idx_protokoll_datum (benutzer_id, erstellt_am),
CONSTRAINT fk_protokoll_benutzer FOREIGN KEY (benutzer_id)
REFERENCES benutzer (id) ON DELETE CASCADE,
CONSTRAINT fk_protokoll_zugang FOREIGN KEY (zugang_id)
REFERENCES bank_zugaenge (id) ON DELETE SET NULL,
CONSTRAINT fk_protokoll_auftrag FOREIGN KEY (auftrag_id)
REFERENCES zahlungsauftraege (id) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;