chore: isolate examples database by default (#25003)

(cherry picked from commit 269c99293f)
This commit is contained in:
Daniel Vaz Gaspar
2023-08-17 11:50:24 +01:00
committed by Michael S. Molina
parent ea27cf13d3
commit c2c5f232c8
6 changed files with 41 additions and 13 deletions

View File

@@ -0,0 +1,15 @@
# ------------------------------------------------------------------------
# Creates the examples database and repective user. This database location
# and access credentials are defined on the environment variables
# ------------------------------------------------------------------------
set -e
psql -v ON_ERROR_STOP=1 --username "${POSTGRES_USER}" <<-EOSQL
CREATE USER ${EXAMPLES_USER} WITH PASSWORD '${EXAMPLES_PASSWORD}';
CREATE DATABASE ${EXAMPLES_DB};
GRANT ALL PRIVILEGES ON DATABASE ${EXAMPLES_DB} TO ${EXAMPLES_USER};
EOSQL
psql -v ON_ERROR_STOP=1 --username "${POSTGRES_USER}" -d "${EXAMPLES_DB}" <<-EOSQL
GRANT ALL ON SCHEMA public TO ${EXAMPLES_USER};
EOSQL