summaryrefslogtreecommitdiffstats
path: root/kubernetes/common/postgres-init/resources
diff options
context:
space:
mode:
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>2021-10-15 13:04:33 +0000
committerGerrit Code Review <gerrit@onap.org>2021-10-15 13:04:33 +0000
commit1d08808841edcea39acdff8ae2fd014ebd4fe75b (patch)
treee1048b10998673aac6744776579ccbc659d66eb5 /kubernetes/common/postgres-init/resources
parent0de14cb83a3963c76f98e38fc37e57dd26697079 (diff)
parent988aeedf9344fefb417af0d8377666b711eb80ce (diff)
Merge "[CPS] Use common postgres for CPS"
Diffstat (limited to 'kubernetes/common/postgres-init/resources')
-rw-r--r--kubernetes/common/postgres-init/resources/config/setup.sql19
1 files changed, 19 insertions, 0 deletions
diff --git a/kubernetes/common/postgres-init/resources/config/setup.sql b/kubernetes/common/postgres-init/resources/config/setup.sql
new file mode 100644
index 0000000000..06e07245be
--- /dev/null
+++ b/kubernetes/common/postgres-init/resources/config/setup.sql
@@ -0,0 +1,19 @@
+--- User Setup
+CREATE USER "${PG_USER}" LOGIN;
+ALTER USER "${PG_USER}" PASSWORD '${PG_PASSWORD}';
+
+CREATE DATABASE ${PG_DATABASE};
+GRANT ALL PRIVILEGES ON DATABASE ${PG_DATABASE} TO "${PG_USER}";
+
+--- PG_DATABASE Setup
+
+\c ${PG_DATABASE}
+
+CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
+CREATE EXTENSION IF NOT EXISTS pgaudit;
+
+--- Create schema for PG_USER
+
+\c ${PG_DATABASE}
+
+CREATE SCHEMA IF NOT EXISTS "${PG_USER}" AUTHORIZATION "${PG_USER}";