From 875502b2e13dbc1ae7ba6c1b63ac5af428d9e4a5 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Mon, 12 Jun 2023 22:58:59 +0000 Subject: [PATCH] upgrade-postgresql: Only upgrade to a supported version. --- scripts/setup/upgrade-postgresql | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/setup/upgrade-postgresql b/scripts/setup/upgrade-postgresql index f8d91bf710..d75deb6d17 100755 --- a/scripts/setup/upgrade-postgresql +++ b/scripts/setup/upgrade-postgresql @@ -12,7 +12,8 @@ export LC_ALL=C.UTF-8 export LANG=C.UTF-8 export LANGUAGE=C.UTF-8 -UPGRADE_TO=${1:-15} +LATEST_SUPPORTED_VERSION=15 +UPGRADE_TO=${1:-$LATEST_SUPPORTED_VERSION} UPGRADE_FROM=$(crudini --get /etc/zulip/zulip.conf postgresql version) ZULIP_PATH="$(dirname "$0")/../.." @@ -26,6 +27,12 @@ if [[ "$UPGRADE_TO" -lt "$UPGRADE_FROM" ]]; then exit 1 fi +if [[ "$UPGRADE_TO" -gt "$LATEST_SUPPORTED_VERSION" ]]; then + echo "This version of Zulip does not support PostgreSQL $UPGRADE_TO." + echo "You may need to upgrade Zulip before you can upgrade to PostgreSQL $UPGRADE_TO." + exit 1 +fi + # Verify that the version in /etc/zulip/zulip.conf is the version that # Django actually stores its data in. We can only do that if the # database server is on the same host as the application server.