Files
Kazier/backend/db/migrations/000013_operations_payload_hash.up.sql
T
m a6b7f2002b
CI / lint-backend (push) Failing after 1m39s
CI / lint-mobile (push) Canceled after 11m8s
CI / test-backend (push) Canceled after 0s
CI / test-mobile (push) Canceled after 0s
CI / build-backend (push) Canceled after 0s
CI / docker (push) Canceled after 0s
fix backend audit findings (auth, upload, sync, data, ocr, contract)
2026-09-21 19:59:52 +02:00

11 lines
539 B
SQL

-- Trace outbox : hash du payload (A9, LOT 3).
-- Au rejeu du même (device_id, operation_id) avec un payload différent, le
-- serveur rejette en INVALID_REQUEST au lieu d'un skip silencieux.
-- Colonne NULLABLE : les traces héritées (pré-000013) restent valides ; pour
-- elles, le hash est recalculé en Go depuis le payload stocké.
ALTER TABLE operations ADD COLUMN payload_hash TEXT;
ALTER TABLE operations
ADD CONSTRAINT operations_payload_hash_hex_check
CHECK (payload_hash IS NULL OR payload_hash ~ '^[0-9a-f]{64}$');