mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
Drop database users prior to DROP/CREATE database.
This fixes an annoying issue where one tries to rebuild the database, and it fails due to there being existing connections. The one thing that is potentially scary about this implementation is that it means it's now a lot easier to accidentally drop your production database by running the wrong script; might be worth adding a "--force" flag controlling this behavior or something. Thanks to Nemanja Stanarevic and Neeraj Wahi for prototypes of this implementation! They did most of the work and testing for this.
This commit is contained in:
@@ -49,6 +49,8 @@ else
|
||||
fi
|
||||
chmod go-rw ~/.pgpass
|
||||
|
||||
"$(dirname "$0")/../scripts/setup/terminate-psql-sessions" "$USERNAME" "$DBNAME" "$DBNAME_BASE"
|
||||
|
||||
psql -h localhost postgres "$USERNAME" <<EOF
|
||||
DROP DATABASE IF EXISTS $DBNAME;
|
||||
DROP DATABASE IF EXISTS $DBNAME_BASE;
|
||||
|
||||
Reference in New Issue
Block a user