DockerPostgresMigration/migrate.sh

28 lines
441 B
Bash
Raw Normal View History

2024-12-06 10:32:50 +00:00
#!/bin/bash
echo Migrate PostgreSQL version
DB_PATH=/db
OLD_DB_PATH=/tmp/old_db
# Run database on a COPY of the database
cp -r "$DB_PATH" "$OLD_DB_PATH"
# Start the database in the background
/postgres/16/bin/postgres -D /tmp/old_db/ &
while true;
do
echo Waiting for database...
if echo "\q" | /postgres/16/bin/psql -U "$POSTGRES_USER";
then
break
fi
done
# Perform dump
# Stop database
#pkill postgres
bash