Premiere commit - Omika

This commit is contained in:
2026-10-23 18:46:50 +02:00
commit 8ea76c1b24
2155 changed files with 984301 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
-- ============================================================
-- Omika Diagnostic Center — 002_actor_key.sql (Phase 5B2A.1)
-- Pseudonymisation ActorKey (HMAC-SHA256) pour la recherche support.
-- ============================================================
-- IDEMPOTENT : ADD COLUMN IF NOT EXISTS + CREATE INDEX IF NOT EXISTS.
-- AUCUN DROP, AUCUNE suppression, AUCUNE migration destructive.
-- PostgreSQL 18 compatible (syntaxe disponible depuis 9.6).
--
-- ActorKey = HMAC-SHA256( "v1|tenant:<CodeClient>|collaborateur:<CollaborateurId>" )
-- calculé côté SERVEUR (Omika.Api) depuis l'identité AUTHENTIFIÉE (§3).
-- Format : hexadécimal minuscule, 64 caractères. NULL = système / sans
-- utilisateur / clé HMAC indisponible (fail-open).
-- ActorKeyVersion = version de l'algorithme (1 aujourd'hui) → rotation future.
-- ============================================================
ALTER TABLE diagnostic_event
ADD COLUMN IF NOT EXISTS actor_key TEXT,
ADD COLUMN IF NOT EXISTS actor_key_version INTEGER;
-- Recherche support « tous les diagnostics d'un collaborateur » (§12) :
-- index composé (actor_key, timestamp_utc DESC).
CREATE INDEX IF NOT EXISTS ix_diagnostic_event_actor_key_timestamp
ON diagnostic_event (actor_key, timestamp_utc DESC);