diff --git a/postgres/init-scripts/01-init-databases.sh b/postgres/init-scripts/01-init-databases.sh index 4f58793..743bcbe 100755 --- a/postgres/init-scripts/01-init-databases.sh +++ b/postgres/init-scripts/01-init-databases.sh @@ -16,19 +16,19 @@ create_db_and_user() { psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL -- Create database - CREATE DATABASE $($db_name); + CREATE DATABASE "$db_name"; -- Create user with password CREATE USER $db_user WITH ENCRYPTED PASSWORD '$db_password'; -- Grant connection to the specific database only - GRANT CONNECT ON DATABASE $($db_name) TO $db_user; + GRANT CONNECT ON DATABASE "$db_name" TO $db_user; -- Make user owner of the database - ALTER DATABASE $($db_name) OWNER TO $db_user; + ALTER DATABASE "$db_name" OWNER TO $db_user; -- Connect to the specific database to set schema permissions - \c $($db_name) + \c "$db_name" -- Grant schema permissions GRANT ALL ON SCHEMA public TO $db_user;