Files
posthog/docker/postgres-init-scripts/create-cyclotron-db.sh
Meikel Ratz d4dbac3663 feat(cdp): remove legacy kafka based consumer (#27760)
Co-authored-by: Ben White <ben@posthog.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-23 14:09:32 +01:00

16 lines
513 B
Bash

#!/bin/bash
set -e
set -u
echo "Checking if database 'cyclotron' exists..."
DB_EXISTS=$(psql -U "$POSTGRES_USER" -tAc "SELECT 1 FROM pg_database WHERE datname='cyclotron'")
if [ -z "$DB_EXISTS" ]; then
echo "Creating database 'cyclotron'..."
psql -U "$POSTGRES_USER" -c "CREATE DATABASE cyclotron;"
psql -U "$POSTGRES_USER" -c "GRANT ALL PRIVILEGES ON DATABASE cyclotron TO $POSTGRES_USER;"
echo "Database 'cyclotron' created successfully"
else
echo "Database 'cyclotron' already exists"
fi