mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
scripts: Always use ON_ERROR_STOP=1 when running psql.
Also use psql -e (--echo-queries) in scripts that use ‘set -x’, so errors can be traced to a specific query from the output. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
efd22fd2ae
commit
5290519a62
@@ -14,7 +14,7 @@ POSTGRES_USER="${POSTGRES_USER:-postgres}"
|
||||
# We have to do this because on production database zulip may not exist, so psql
|
||||
# will fail with return code 2. Because set -e is on, this will cause the script
|
||||
# to bail.
|
||||
records=$(su "$POSTGRES_USER" -c "psql -Atc 'SELECT COUNT(*) FROM zulip.zerver_message;' zulip" | cat)
|
||||
records=$(su "$POSTGRES_USER" -c "psql -v ON_ERROR_STOP=1 -Atc 'SELECT COUNT(*) FROM zulip.zerver_message;' zulip" | cat)
|
||||
|
||||
if [[ $records -gt 200 ]]
|
||||
then
|
||||
@@ -44,7 +44,7 @@ source "$(dirname "$0")/terminate-psql-sessions" postgres zulip zulip_base
|
||||
# Make sure the current working directory is readable by postgres
|
||||
cd /
|
||||
|
||||
su "$POSTGRES_USER" -c psql <<EOF
|
||||
su "$POSTGRES_USER" -c 'psql -v ON_ERROR_STOP=1 -e' <<EOF
|
||||
DROP DATABASE IF EXISTS zulip;
|
||||
EOF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user