DockerPostgresMigration/migrate.sh
2024-12-06 11:32:50 +01:00

28 lines
441 B
Bash

#!/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