fix(backup): purge pg_largeobject metadata prior to UAT schema reset
AS Talange CI/CD Pipeline - Production / Build & Run Unit Tests (push) Successful in 2m15s
AS Talange CI/CD Pipeline - Production / Deploy to Prod Environment (push) Successful in 1m29s

This commit is contained in:
2026-09-04 09:07:31 +02:00
parent 19e969eb09
commit f6c853068f
+9 -3
View File
@@ -110,7 +110,13 @@ fi
if [ "$STATUS" = "SUCCESS" ] && [ "$ENABLE_UAT_RESTORE" = "true" ]; then
log "Démarrage de la restauration et l'anonymisation sur UAT (${UAT_DB_USER}@${UAT_DB_HOST}:${UAT_DB_PORT}/${UAT_DB_NAME})..."
CLEAN_SCHEMA_SQL="DROP SCHEMA IF EXISTS public CASCADE; CREATE SCHEMA public; GRANT ALL ON SCHEMA public TO ${UAT_DB_USER}; GRANT ALL ON SCHEMA public TO public;"
CLEAN_SCHEMA_SQL="
DO \$\$ DECLARE r RECORD; BEGIN FOR r IN (SELECT oid FROM pg_largeobject_metadata) LOOP PERFORM lo_unlink(r.oid); END LOOP; EXCEPTION WHEN OTHERS THEN NULL; END \$\$;
DROP SCHEMA IF EXISTS public CASCADE;
CREATE SCHEMA public;
GRANT ALL ON SCHEMA public TO ${UAT_DB_USER};
GRANT ALL ON SCHEMA public TO public;
"
ANONYMIZE_SQL="
UPDATE adherent SET
@@ -118,7 +124,7 @@ UPDATE adherent SET
prenom = 'Prenom_Adherent_' || id,
email = 'adherent' || id || '@test.local',
telephone = '06' || LPAD((id)::text, 8, '0'),
lieu_naissance = 'Ville_' || id,
lieu_naissance_ville = 'Ville_' || id,
representant_legal = CASE
WHEN representant_legal IS NOT NULL AND TRIM(representant_legal) <> ''
THEN 'Representant_' || id
@@ -130,7 +136,7 @@ UPDATE pre_inscription SET
prenom = 'Prenom_PreInscr_' || id,
email = 'preinscr' || id || '@test.local',
telephone = '06' || LPAD((id)::text, 8, '0'),
lieu_naissance = 'Ville_' || id,
lieu_naissance_ville = 'Ville_' || id,
representant_legal = CASE
WHEN representant_legal IS NOT NULL AND TRIM(representant_legal) <> ''
THEN 'Representant_PreInscr_' || id