infoalloggi-monorepo/apps/db/pg_dumper.sh
2025-08-04 17:45:44 +02:00

23 lines
733 B
Bash

#!/bin/bash
# Set the necessary environment variables
export PGHOST="localhost"
export PGPORT="5432"
export PGDATABASE="postgres"
export PGUSER="postgres"
export PGPASSWORD="rootpost"
# Call pg_dump.exe to generate the SQL file
"C:/Program Files/PostgreSQL/16/bin/pg_dump.exe" -f "./initial/1_init.sql" --schema-only
"C:/Program Files/PostgreSQL/16/bin/pg_dump.exe" -f "./initial/2_data.sql" --data-only -t prezziario -t banners -t etichette -t flags -t banlist -t testi_e_stringhe -t temp_tokens
# Check if the pg_dump command was successful
if [ $? -eq 0 ]; then
echo "SQL file generated successfully."
else
echo "Failed to generate SQL file."
fi
# Wait for user keypress
read -n 1 -s -r -p "Press any key to exit..."