From 3c69e8dc9ee2df5c7e4bf355f9a81cd3c4a7a4d6 Mon Sep 17 00:00:00 2001 From: Yannick Payot Date: Wed, 6 Sep 2023 15:46:26 +0200 Subject: [PATCH 1/2] Remove TODO comment as not in roadmap --- bin/runmigration | 2 -- 1 file changed, 2 deletions(-) diff --git a/bin/runmigration b/bin/runmigration index ca1bc2ad..944f991a 100755 --- a/bin/runmigration +++ b/bin/runmigration @@ -11,8 +11,6 @@ # # And finally make a database dump if none exists for current VERSION. # -# TODO: store cache on S3 to store one DB per version -# # Environment variables: # # CREATE_DB_CACHE: From 71e6d294dbee7ec25115d31322d29e2d65809a16 Mon Sep 17 00:00:00 2001 From: Yannick Payot Date: Wed, 6 Sep 2023 15:51:34 +0200 Subject: [PATCH 2/2] Allow to set restore a cached DB and create a new one If both LOAD_DB_CACHE (with a ceil version) and CREATE_DB_CACHE were set, in case the directory containing cached DB is empty the CACHED_DUMP variable was emptied and the script was unable to create a new dump. --- bin/runmigration | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/runmigration b/bin/runmigration index 944f991a..213dec29 100755 --- a/bin/runmigration +++ b/bin/runmigration @@ -40,6 +40,7 @@ echo $CACHE_DIR VERSION=$(cat /odoo/VERSION) CACHED_DUMP="$CACHE_DIR/odoo_sample_$VERSION.dmp" +NEW_CACHED_DUMP=$CACHED_DUMP if [ "$LOAD_DB_CACHE" != "false" ]; then @@ -72,9 +73,9 @@ fi gosu odoo migrate # Create a dump if none exist for the current VERSION -if [ "$CREATE_DB_CACHE" == "true" -a ! -f "$CACHED_DUMP" ]; then - echo "Save DB to cache $CACHED_DUMP 🐘⮕ 📦" +if [ "$CREATE_DB_CACHE" == "true" -a ! -f "$NEW_CACHED_DUMP" ]; then + echo "Save DB to cache $NEW_CACHED_DUMP 🐘⮕ 📦" mkdir -p "$CACHE_DIR" - pg_dump -Fp -O -f "$CACHED_DUMP" - ls -l $CACHED_DUMP + pg_dump -Fp -O -f "$NEW_CACHED_DUMP" + ls -l $NEW_CACHED_DUMP fi