mirror of
https://github.com/BillyOutlast/posthog.git
synced 2026-02-06 04:01:23 +01:00
Co-authored-by: Ben White <ben@posthog.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
16 lines
513 B
Bash
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 |