Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

upgrade-postgresql: Get PostgreSQL version without manage.py shell.

Anders Kaseorg927ea011d3ea
diff --git a/scripts/setup/upgrade-postgresql b/scripts/setup/upgrade-postgresql
index c1764345b3b..1115af9f78b 100755
--- a/scripts/setup/upgrade-postgresql
+++ b/scripts/setup/upgrade-postgresql
@@ -37,7 +37,12 @@ fi
# Django actually stores its data in. We can only do that if the
# database server is on the same host as the application server.
if [ -d /home/zulip/deployments/current ]; then
- DATA_IS_IN=$(su zulip -c '/home/zulip/deployments/current/manage.py shell -c "from django.db import connection; print(int(connection.cursor().connection.server_version/10000))"')
+ DATA_IS_IN=$(
+ su -s /usr/bin/env -- zulip \
+ DJANGO_SETTINGS_MODULE=zproject.settings \
+ uv run --directory=/home/zulip/deployments/current --no-sync \
+ python -c 'from django.db import connection; print(connection.cursor().connection.server_version // 10000)'
+ )
if [ "$UPGRADE_FROM" != "$DATA_IS_IN" ]; then
cat <<EOF