mirror of https://github.com/zulip/zulip.git
create-db.sql: Start by dropping the zulip database if needed.
At some point the PostgreSQL Docker image started creating the zulip database for us, which caused our CREATE DATABASE to fail. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
parent
298d45b46a
commit
8c733a3f68
|
@ -1,3 +1,5 @@
|
||||||
|
\connect postgres
|
||||||
|
DROP DATABASE IF EXISTS zulip;
|
||||||
DO $$BEGIN
|
DO $$BEGIN
|
||||||
CREATE USER zulip;
|
CREATE USER zulip;
|
||||||
EXCEPTION WHEN duplicate_object THEN
|
EXCEPTION WHEN duplicate_object THEN
|
||||||
|
|
|
@ -44,10 +44,6 @@ source "$(dirname "$0")/terminate-psql-sessions" postgres zulip zulip_base
|
||||||
# Make sure the current working directory is readable by postgres
|
# Make sure the current working directory is readable by postgres
|
||||||
cd /
|
cd /
|
||||||
|
|
||||||
su "$POSTGRES_USER" -c 'psql -v ON_ERROR_STOP=1 -e' <<EOF
|
|
||||||
DROP DATABASE IF EXISTS zulip;
|
|
||||||
EOF
|
|
||||||
|
|
||||||
su "$POSTGRES_USER" -c 'psql -v ON_ERROR_STOP=1 -e' < "$(dirname "$0")/create-db.sql"
|
su "$POSTGRES_USER" -c 'psql -v ON_ERROR_STOP=1 -e' < "$(dirname "$0")/create-db.sql"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue