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

10 lines
382 B
Bash
Raw Permalink Normal View History

2025-04-13 01:47:22 -05:00
#!/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