#!/bin/bash -ex

mkdir -p /tablespaces/mirai
chown postgres:postgres /tablespaces/mirai
chmod 750 /tablespaces/mirai
psql -v ON_ERROR_STOP=1 \
    --username "$POSTGRES_USER" \
    --dbname "$POSTGRES_DB" \
    -c "CREATE TABLESPACE mirai LOCATION '/tablespaces/mirai'"
