aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/policy/resources/config/db-pg.sh
diff options
context:
space:
mode:
Diffstat (limited to 'kubernetes/policy/resources/config/db-pg.sh')
-rw-r--r--kubernetes/policy/resources/config/db-pg.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/kubernetes/policy/resources/config/db-pg.sh b/kubernetes/policy/resources/config/db-pg.sh
index 913ccc7728..a7fc088d55 100644
--- a/kubernetes/policy/resources/config/db-pg.sh
+++ b/kubernetes/policy/resources/config/db-pg.sh
@@ -20,10 +20,15 @@
export PGPASSWORD=${PG_ADMIN_PASSWORD};
+echo "Create user ${PG_USER} is created in Host ${PG_HOST}"
psql -h ${PG_HOST} -p ${PG_PORT} -U postgres --command "CREATE USER \"${PG_USER}\" WITH PASSWORD '${PG_USER_PASSWORD}'"
for db in migration pooling policyadmin policyclamp operationshistory clampacm
do
+ echo "Create DB ${db}"
psql -h ${PG_HOST} -p ${PG_PORT} -U postgres --command "CREATE DATABASE ${db};"
+ echo "Grant privileges to DB ${db} for user ${PG_USER}"
psql -h ${PG_HOST} -p ${PG_PORT} -U postgres --command "GRANT ALL PRIVILEGES ON DATABASE ${db} TO \"${PG_USER}\";"
-done \ No newline at end of file
+ echo "Grant privileges to SCHEMA public for user ${PG_USER}"
+ psql -h ${PG_HOST} -p ${PG_PORT} -d ${db} -U postgres --command "GRANT ALL ON SCHEMA public TO \"${PG_USER}\";"
+done