openstreetmap-website/docker/postgres/openstreetmap-postgres-init.sh
Michal Migurski 033c3b28b3 Added complete Rails test suite
- Added db/functions/functions.sql to docker-compose DB image
- Added `file`, `libgd-dev`, and `unzip` packages to help tests pass
2021-01-28 12:03:58 -08:00

14 lines
495 B
Bash
Executable file

#!/bin/bash
set -ex
# Create 'openstreetmap' user
psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" <<-EOSQL
CREATE USER openstreetmap SUPERUSER PASSWORD 'openstreetmap';
GRANT ALL PRIVILEGES ON DATABASE openstreetmap TO openstreetmap;
EOSQL
# Create btree_gist extensions
psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -c "CREATE EXTENSION btree_gist" openstreetmap
# Define custom functions
psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -f "/usr/local/sbin/osm-db-functions.sql" openstreetmap