movie-night-api/init-scripts/01-create-db.sh

10 lines
No EOL
382 B
Bash

#!/bin/bash
set -e
# Create a postgres database for the user set in the .env file.
# Everything works fine without this, but this prevents a FATAL
# error from spamming the logs
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE DATABASE "$POSTGRES_USER";
GRANT ALL PRIVILEGES ON DATABASE "$POSTGRES_USER" TO "$POSTGRES_USER";
EOSQL