This repository has been archived on 2026-11-08. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Concilium/docker/init-multi-db.sh
james.maesandClaude Opus 4.6 0ac0f4ec75 feat: add Docker dev stack with Postgres and MinIO
Docker Compose configuration for local development with PostgreSQL 17
and MinIO (S3-compatible object storage). Includes helper scripts for
start/stop, multi-database init, Liquibase migrations Dockerfile, and
production Dockerfile using distroless Java 21.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 09:21:06 -05:00

13 lines
450 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
IFS=',' read -ra DBS <<< "$POSTGRES_MULTIPLE_DATABASES"
for db in "${DBS[@]}"; do
db=$(echo "$db" | tr -d '[:space:]')
echo "Creating database: $db"
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
SELECT 'CREATE DATABASE "$db"' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '$db')\gexec
GRANT ALL PRIVILEGES ON DATABASE "$db" TO "$POSTGRES_USER";
EOSQL
done