Skip to content

Commit

Permalink
prettify dumpDatabase.sh output
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskfla committed Apr 6, 2024
1 parent 9a12f9d commit fb478f3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/database/scripts/dumpDatabase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function show_loading_spinner() {

DIR=$(pwd "$0")
. "$DIR/../../scripts/bash/mergeEnvForDB.sh"
. "$DIR/../../scripts/bash/ansiControlSequences.sh"

DUMP_FILE_NAME="dump.sql"

Expand Down Expand Up @@ -73,7 +74,7 @@ if [ "$identity_file" == "" ]; then
fi

if [ "$DB_PG_USER" == "" ] || [ "$DB_PG_PASSWORD" == "" ]; then
echo "Missing postgres user credential env vars in @tupaia/database .env file. Check LastPass for variables and add them to the .env file"
echo -e "${RED}Missing Postgres user credential env vars in @tupaia/database .env file.${RESET} Check Bitwarden for variables and add them to the .env file"
exit 1
fi

Expand All @@ -87,6 +88,5 @@ target_zip_path="$target_path.gz"
show_loading_spinner "Dumping database to $target_zip_path" "PGPASSWORD=$DB_PG_PASSWORD pg_dump \"host=$host user=$DB_PG_USER dbname=tupaia sslmode=require sslkey=$identity_file\" -Z1 -f $target_zip_path"
show_loading_spinner "Unzipping $target_zip_path" "gunzip -f $target_zip_path"

echo "Dump file available at $target_path"

echo "Done!"
echo "Dump file available at $target_path"
echo -e "${GREEN}Done!${RESET}"

0 comments on commit fb478f3

Please sign in to comment.