#!/bin/bash
set -e

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
    create user hwsd_component with login password 'secret';
    create database hwsd_component;
    grant all on database hwsd_component to hwsd_component;

    create user hwsd_run with login password 'secret';
    create database hwsd_run;
    grant all on database hwsd_run to hwsd_run;

    create user hwsd_test with login password 'secret';
    create database hwsd_test;
    grant all on database hwsd_test to hwsd_test;

    create user hwsd_station with login password 'secret';
    create database hwsd_station;
    grant all on database hwsd_station to hwsd_station;
EOSQL
