diff --git a/server/.env.test b/server/.env.test index b7fcf1a40..3c8c46a2a 100644 --- a/server/.env.test +++ b/server/.env.test @@ -14,7 +14,7 @@ PQSL_USER=postgres PSQL_PWD=password PSQL_URI=postgresql://postgres:password@127.0.0.1:5432/orion-test-VITEST_POOL_ID PSQL_CA= -PSQL_LOG_LEVEL=query +PSQL_LOG_LEVEL=error # Auth AUTH_JWT_SECRET=abcdef ACTIVATION_JWT_SECRET=abcdef diff --git a/server/seed/generate-seed.sh b/server/seed/generate-seed.sh index d5f199308..e818847f8 100755 --- a/server/seed/generate-seed.sh +++ b/server/seed/generate-seed.sh @@ -2,7 +2,9 @@ readonly VAULT_PASSWORD_CLIENT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/vault/get-vault-password-client.sh" -echo "Chemin de VAULT_PASSWORD_CLIENT : $VAULT_PASSWORD_CLIENT" +echo "" +echo "🔀 Chemin de VAULT_PASSWORD_CLIENT : $VAULT_PASSWORD_CLIENT" +echo "" readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" readonly ANSIBLE_DIR="${SCRIPT_DIR}/../../.infra/ansible" @@ -10,24 +12,26 @@ readonly INFRA_DIR="${SCRIPT_DIR}/../../.infra/vault" readonly VAULT_FILE="${1:-${INFRA_DIR}/vault.yml}" readonly VAULT_PASSWORD_FILE="${SCRIPT_DIR}/../../.bin/scripts/get-vault-password-client.sh" -echo "Lancement de la génération de la seed" - +echo "🚀 Lancement de la génération de la seed" +echo "" # Récupérer les informations d'identification de la base de données à partir du Vault DB_URL=$(ansible-vault view $VAULT_FILE --vault-password-file "${VAULT_PASSWORD_FILE}" | grep PSQL_URI | head -n 1 | awk '{print $2}' | xargs) SCHEMA_DUMP_FILE="seed_schema.dump" DATA_DUMP_FILE="seed_data.dump" -echo "DB_URL : $DB_URL" +echo "🔑 DB_URL : $DB_URL" echo "" # Générer le fichier de dump -echo "Génération de la seed contenant le schéma de la DB" +echo "🌱 Génération de la seed contenant le schéma de la DB" echo "" -pg_dump $DB_URL -Fc --clean --if-exists --create --schema-only --file $SCHEMA_DUMP_FILE +pg_dump $DB_URL --format=custom --clean --if-exists --create --schema-only --file $SCHEMA_DUMP_FILE -echo "Génération de la seed contenant les données de la DB" -pg_dump $DB_URL -Fc --data-only \ +echo "🤖 Génération de la seed contenant les données de la DB" +echo "" + +pg_dump $DB_URL --format=custom --data-only \ --exclude-table='public."changeLog"' \ --exclude-table='public."changementStatut"' \ --exclude-table='public."demande"' \ @@ -40,7 +44,8 @@ pg_dump $DB_URL -Fc --data-only \ --file $DATA_DUMP_FILE if [ $? -eq 0 ]; then - echo "Dump de la base de données généré avec succès" + echo "✅ Dump de la base de données généré avec succès" else - echo "Échec de la génération du dump de la base de données." + echo "❌ Échec de la génération du dump de la base de données." fi + diff --git a/server/seed/seed_data.dump b/server/seed/seed_data.dump index 699dde756..f1bdb5a9e 100644 Binary files a/server/seed/seed_data.dump and b/server/seed/seed_data.dump differ diff --git a/server/seed/seed_schema.dump b/server/seed/seed_schema.dump index 52c2a52d5..3065c5d55 100644 Binary files a/server/seed/seed_schema.dump and b/server/seed/seed_schema.dump differ diff --git a/server/tests/pg.test.utils.ts b/server/tests/pg.test.utils.ts index 3e019b135..a1ba462b0 100644 --- a/server/tests/pg.test.utils.ts +++ b/server/tests/pg.test.utils.ts @@ -22,6 +22,8 @@ export const startAndConnectPg = async () => { await connectToPgDb(dbUri); + await refreshViews(); + await migrateToLatest(true, false); console.log("Migration terminée"); console.log("Rafraichissement des vues matérialisées");