mirror of
https://github.com/MatthewL246/pretendo-docker.git
synced 2026-03-21 17:34:37 -05:00
This should hopefully fix the issue where some people run the setup script but no Postgres databases get created.
13 lines
343 B
Bash
13 lines
343 B
Bash
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
databases="friends super_mario_maker"
|
|
|
|
for database in $databases; do
|
|
if [ "$(psql -At -U "$POSTGRES_USER" -c "SELECT 1 FROM pg_database WHERE datname='$database'")" = '' ]; then
|
|
echo "Creating database: $database"
|
|
psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -c "CREATE DATABASE $database;"
|
|
fi
|
|
done
|