2017-12-13 19:02:16 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2017-02-15 03:01:47 +00:00
|
|
|
# Because both template1 and the user postgres database have already been created,
|
|
|
|
# we need to create the hstore extension in template1 and then recreate the postgres database.
|
|
|
|
#
|
|
|
|
# Running CREATE EXTENSION in both template1 and postgres can lead to
|
|
|
|
# the extensions having different eid's.
|
2019-05-12 13:58:49 +00:00
|
|
|
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname template1 <<EOSQL
|
2017-02-15 03:01:47 +00:00
|
|
|
CREATE EXTENSION hstore;
|
|
|
|
CREATE EXTENSION ltree;
|
2018-04-27 20:53:38 +00:00
|
|
|
CREATE EXTENSION pg_trgm;
|
2017-02-15 03:01:47 +00:00
|
|
|
DROP DATABASE $POSTGRES_USER;
|
|
|
|
CREATE DATABASE $POSTGRES_USER TEMPLATE template1;
|
|
|
|
EOSQL
|
|
|
|
|