M365-02: 02 sharepoint onedrive dokumentabgleich

Migration fuer m365_doc_records (Dokument-Reconciliation-State je
Connector-Instanz, getrennte external/nexarch Hash-Staende fuer
Konflikterkennung).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
patrickandClaude Sonnet 5 committed 2026-09-28 01:10:06 +00:00
1 parent ac09173b99
commit 72cbca286a
2 files changed
+27

No files matched your search

@@ -0,0 +1 @@
DROP TABLE IF EXISTS m365_doc_records;
@@ -0,0 +1,26 @@
-- M365-02: SharePoint/OneDrive-Dokumentabgleich. Getrennte Hash-Staende fuer
-- die zuletzt von Graph gesehene Fassung und die NEXARCH-seitig zuletzt
-- uebernommene Fassung, analog zu master_data_records (ERP-03) -- ein
-- Auseinanderlaufen beider Hashes bei gleichzeitiger externer Aenderung ist
-- ein Konflikt (AC2) statt einer stillen Ueberschreibung.
CREATE TABLE m365_doc_records (
id BIGSERIAL PRIMARY KEY,
tenant_slug TEXT NOT NULL,
connector_name TEXT NOT NULL,
connector_instance_id TEXT NOT NULL,
external_id TEXT NOT NULL,
name TEXT NOT NULL,
path TEXT NOT NULL,
size_bytes BIGINT NOT NULL,
modified_at TIMESTAMPTZ NOT NULL,
external_hash TEXT NOT NULL,
nexarch_hash TEXT NOT NULL,
conflict BOOLEAN NOT NULL DEFAULT false,
conflict_detected_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
UNIQUE (tenant_slug, connector_name, connector_instance_id, external_id)
);
CREATE INDEX m365_doc_records_ref_idx
ON m365_doc_records (tenant_slug, connector_name, connector_instance_id);