Skip to content

Commit

Permalink
fix(pg-create): decouple create and grant (#936)
Browse files Browse the repository at this point in the history
  • Loading branch information
devthejo committed Jan 10, 2022
1 parent eb2cc26 commit 9b6b185
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion azure-db/bin/create-db-user
@@ -1,6 +1,6 @@
#!/bin/bash
set +x
set -e
set +e

#
# create a new user and DB on a remote Azure Postgres server
Expand Down Expand Up @@ -44,6 +44,10 @@ echo "creating user ${NEW_USER_BASE} on ${PGHOST}"
psql -abe "$PG_URL_ADMIN" -c "
SET timezone TO 'Europe/Paris';
CREATE USER \"$NEW_USER_BASE\" WITH PASSWORD '$NEW_PASSWORD';
"

echo "grant user ${NEW_USER_BASE} on ${PGHOST}"
psql -abe "$PG_URL_ADMIN" -c "
GRANT \"$NEW_USER_BASE\" to \"${PGUSER%%@*}\";
GRANT ALL PRIVILEGES ON DATABASE \"$NEW_DB_NAME\" TO \"$NEW_USER_BASE\";
Expand Down

0 comments on commit 9b6b185

Please sign in to comment.