Skip to content

Commit

Permalink
fix: create-multiple-databases.sh aborting
Browse files Browse the repository at this point in the history
  • Loading branch information
danielptv committed Nov 13, 2023
1 parent 47156de commit 6ffc018
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions create-multiple-databases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ function create_user_and_database() {
psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -d "$POSTGRES_DB" <<-EOSQL
CREATE USER "$user";
ALTER USER "$user" WITH ENCRYPTED PASSWORD '$password';
CREATE DATABASE "$database";
GRANT ALL PRIVILEGES ON DATABASE "$database" TO "$user";
EOSQL
fi

psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -d "$POSTGRES_DB" <<-EOSQL
CREATE DATABASE "$database";
GRANT ALL PRIVILEGES ON DATABASE "$database" TO "$user";
else
psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -d "$POSTGRES_DB" <<-EOSQL
CREATE DATABASE "$database";
GRANT ALL PRIVILEGES ON DATABASE "$database" TO "$user";
EOSQL
fi
}

if [ -n "$POSTGRES_MULTIPLE_DATABASES" ]; then
Expand Down

0 comments on commit 6ffc018

Please sign in to comment.