fix backend audit findings (auth, upload, sync, data, ocr, contract)
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
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
This commit is contained in:
@@ -1,4 +1,23 @@
|
||||
-- Down de 000008 : retour operation_id TEXT 32-hex → BIGINT.
|
||||
-- PERTES ASSUMÉES, chemin TESTS uniquement (migrate down complet) : seules
|
||||
-- les valeurs exclusivement numériques sur ≤ 18 chiffres significatifs
|
||||
-- (traces héritées paddées par le up, p.ex. '0000…0042' → 42) survivent ;
|
||||
-- les vrais 32-hex client-generated (contenant a-f, ou > 18 chiffres pour
|
||||
-- éviter tout overflow bigint) ne sont pas convertibles et leurs lignes
|
||||
-- sont supprimées. L'ancien `USING operation_id::bigint` échouait sur ces
|
||||
-- valeurs. Ne jamais down en production avec des données V1 : recréer la
|
||||
-- base plutôt que `migrate down`.
|
||||
ALTER TABLE operations DROP CONSTRAINT operations_operation_id_hex_check;
|
||||
|
||||
ALTER TABLE operations
|
||||
ALTER COLUMN operation_id TYPE BIGINT USING operation_id::bigint;
|
||||
ALTER TABLE operations ADD COLUMN operation_id_bigint BIGINT;
|
||||
|
||||
UPDATE operations
|
||||
SET operation_id_bigint = operation_id::bigint
|
||||
WHERE operation_id ~ '^0*[0-9]{1,18}$';
|
||||
|
||||
DELETE FROM operations WHERE operation_id_bigint IS NULL;
|
||||
|
||||
ALTER TABLE operations DROP COLUMN operation_id;
|
||||
ALTER TABLE operations RENAME COLUMN operation_id_bigint TO operation_id;
|
||||
ALTER TABLE operations ALTER COLUMN operation_id SET NOT NULL;
|
||||
ALTER TABLE operations ADD CONSTRAINT operations_unique_per_device UNIQUE (device_id, operation_id);
|
||||
|
||||
Reference in New Issue
Block a user