File: initdb-mobilitydb.sh

package info (click to toggle)
mobilitydb 1.3.0~alpha-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 118,528 kB
  • sloc: ansic: 166,361; sql: 99,983; xml: 22,860; yacc: 447; makefile: 200; lex: 151; sh: 142
file content (26 lines) | stat: -rw-r--r-- 827 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

set -e

echo "shared_preload_libraries = 'postgis-3.so'" >> "$PGDATA"/postgresql.conf

# Perform all actions as $POSTGRES_USER
export PGUSER="$POSTGRES_USER"

# Create the 'template_mobilitydb' template db
"${psql[@]}" <<- 'EOSQL'
CREATE DATABASE template_mobilitydb IS_TEMPLATE true;
EOSQL

# Load mobilitydb into both template_database and $POSTGRES_DB
# Since $POSTGRES_DB already has postgis, we must use
# LOAD 'postgis-3.so' to be able to create the mobilitydb extension
# (the shared_preload_libraries setting above has not taken effect yet)
for DB in template_mobilitydb "$POSTGRES_DB"; do
  echo "Loading mobilitydb extensions into $DB"
  "${psql[@]}" --dbname="$DB" <<-'EOSQL'
    CREATE EXTENSION IF NOT EXISTS postgis;
    LOAD 'postgis-3.so';
    CREATE EXTENSION IF NOT EXISTS mobilitydb;
EOSQL
done