mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
ad5c1ea397
Set New Version from 13 to 17 to allow Upgrades
35 lines
904 B
Bash
Executable File
35 lines
904 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
set -o pipefail
|
|
|
|
CURRENT_PGVERSION="$(cat $PGDATA/PG_VERSION)"
|
|
NEW_PGVERSION="17"
|
|
|
|
if [ "$CURRENT_PGVERSION" == "$NEW_PGVERSION" ]; then
|
|
echo "Current and new postgres version are identical. Aborting."
|
|
exit 1
|
|
fi
|
|
|
|
export PGBINOLD="/usr/lib/postgresql/$CURRENT_PGVERSION/bin"
|
|
export PGBINNEW="/usr/lib/postgresql/$NEW_PGVERSION/bin"
|
|
export PGDATAOLD="$PGDATA"
|
|
if [ "$OPENPROJECT_INSTALLATION__TYPE" == "docker" ]; then
|
|
export PGDATANEW="$PGDATA-next"
|
|
else
|
|
export PGDATANEW="/var/lib/postgresql/$NEW_PGVERSION/main"
|
|
fi
|
|
|
|
if [ ! -d "$PGDATANEW" ]; then
|
|
echo "$PGDATANEW does not exist."
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "$PGDATANEW/PG_VERSION" ]; then
|
|
echo "Empty cluster found in $PGDATANEW. Generating cluster..."
|
|
PGBIN=$PGBINNEW PGDATA=$PGDATANEW ./docker/prod/postgres-db-init
|
|
fi
|
|
|
|
cd /var/lib/postgresql
|
|
su -m postgres -c "$PGBINNEW/pg_upgrade"
|
|
su -m postgres -c "./analyze_new_cluster.sh"
|