From 7c3ac06b497f86d18c5c05cd91077b663a514e6f Mon Sep 17 00:00:00 2001 From: Simon L Date: Tue, 17 Jan 2023 16:19:48 +0100 Subject: [PATCH] add new commands Signed-off-by: Simon L --- Containers/postgresql/init-user-db.sh | 2 ++ Containers/postgresql/start.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Containers/postgresql/init-user-db.sh b/Containers/postgresql/init-user-db.sh index 8c1f2dc9..cfd3827a 100644 --- a/Containers/postgresql/init-user-db.sh +++ b/Containers/postgresql/init-user-db.sh @@ -6,6 +6,8 @@ touch "$DUMP_DIR/initialization.failed" psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL CREATE USER "oc_$POSTGRES_USER" WITH PASSWORD '$POSTGRES_PASSWORD' CREATEDB; ALTER DATABASE "$POSTGRES_DB" OWNER TO "oc_$POSTGRES_USER"; + GRANT ALL PRIVILEGES ON DATABASE "$POSTGRES_DB" TO "oc_$POSTGRES_USER"; + GRANT ALL PRIVILEGES ON SCHEMA public TO "oc_$POSTGRES_USER"; EOSQL rm "$DUMP_DIR/initialization.failed" diff --git a/Containers/postgresql/start.sh b/Containers/postgresql/start.sh index 8774d1be..905daf96 100644 --- a/Containers/postgresql/start.sh +++ b/Containers/postgresql/start.sh @@ -110,6 +110,8 @@ if ( [ -f "$DATADIR/PG_VERSION" ] && [ "$PG_MAJOR" != "$(cat "$DATADIR/PG_VERSIO psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL CREATE USER "$DB_OWNER" WITH PASSWORD '$POSTGRES_PASSWORD' CREATEDB; ALTER DATABASE "$POSTGRES_DB" OWNER TO "$DB_OWNER"; + GRANT ALL PRIVILEGES ON DATABASE "$POSTGRES_DB" TO "$DB_OWNER"; + GRANT ALL PRIVILEGES ON SCHEMA public TO "$DB_OWNER"; EOSQL fi