fix(backup): purge pg_largeobject metadata prior to UAT schema reset
This commit is contained in:
@@ -110,7 +110,13 @@ fi
|
|||||||
if [ "$STATUS" = "SUCCESS" ] && [ "$ENABLE_UAT_RESTORE" = "true" ]; then
|
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})..."
|
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="
|
ANONYMIZE_SQL="
|
||||||
UPDATE adherent SET
|
UPDATE adherent SET
|
||||||
@@ -118,7 +124,7 @@ UPDATE adherent SET
|
|||||||
prenom = 'Prenom_Adherent_' || id,
|
prenom = 'Prenom_Adherent_' || id,
|
||||||
email = 'adherent' || id || '@test.local',
|
email = 'adherent' || id || '@test.local',
|
||||||
telephone = '06' || LPAD((id)::text, 8, '0'),
|
telephone = '06' || LPAD((id)::text, 8, '0'),
|
||||||
lieu_naissance = 'Ville_' || id,
|
lieu_naissance_ville = 'Ville_' || id,
|
||||||
representant_legal = CASE
|
representant_legal = CASE
|
||||||
WHEN representant_legal IS NOT NULL AND TRIM(representant_legal) <> ''
|
WHEN representant_legal IS NOT NULL AND TRIM(representant_legal) <> ''
|
||||||
THEN 'Representant_' || id
|
THEN 'Representant_' || id
|
||||||
@@ -130,7 +136,7 @@ UPDATE pre_inscription SET
|
|||||||
prenom = 'Prenom_PreInscr_' || id,
|
prenom = 'Prenom_PreInscr_' || id,
|
||||||
email = 'preinscr' || id || '@test.local',
|
email = 'preinscr' || id || '@test.local',
|
||||||
telephone = '06' || LPAD((id)::text, 8, '0'),
|
telephone = '06' || LPAD((id)::text, 8, '0'),
|
||||||
lieu_naissance = 'Ville_' || id,
|
lieu_naissance_ville = 'Ville_' || id,
|
||||||
representant_legal = CASE
|
representant_legal = CASE
|
||||||
WHEN representant_legal IS NOT NULL AND TRIM(representant_legal) <> ''
|
WHEN representant_legal IS NOT NULL AND TRIM(representant_legal) <> ''
|
||||||
THEN 'Representant_PreInscr_' || id
|
THEN 'Representant_PreInscr_' || id
|
||||||
|
|||||||
Reference in New Issue
Block a user