daddy/misc/containers/postgres/initdb.d/init-databases.sh

16 lines
514 B
Bash
Raw Permalink Normal View History

#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER hydra WITH ENCRYPTED PASSWORD 'hydra';
CREATE DATABASE hydra;
GRANT ALL PRIVILEGES ON DATABASE hydra TO hydra;
EOSQL
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER daddy WITH ENCRYPTED PASSWORD 'daddy';
CREATE DATABASE daddy;
GRANT ALL PRIVILEGES ON DATABASE daddy TO daddy;
ALTER DATABASE daddy OWNER TO daddy;
EOSQL