#!/bin/bash
set -e

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
    CREATE USER unleash WITH PASSWORD '${UNLEASH_DB_PASSWORD:-unleash}';
    CREATE DATABASE unleash;
    GRANT ALL PRIVILEGES ON DATABASE unleash TO unleash;
EOSQL
