move things around

This commit is contained in:
Matthew Hodgson
2024-11-08 10:22:00 +00:00
parent 483f71d58f
commit 196b10fb11
4 changed files with 2 additions and 2 deletions

View File

@@ -1,24 +0,0 @@
#!/bin/bash
# from https://github.com/mrts/docker-postgresql-multiple-databases
set -e
set -u
function create_user_and_database() {
local database=$1
echo " Creating user and database '$database'"
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
CREATE USER $database;
CREATE DATABASE $database;
GRANT ALL PRIVILEGES ON DATABASE $database TO $database;
EOSQL
}
if [ -n "$POSTGRES_MULTIPLE_DATABASES" ]; then
echo "Multiple database creation requested: $POSTGRES_MULTIPLE_DATABASES"
for db in $(echo $POSTGRES_MULTIPLE_DATABASES | tr ',' ' '); do
create_user_and_database $db
done
echo "Multiple databases created"
fi