# HG changeset patch # User smith@nwoca.org # Date 1460148003 -3600 # Node ID 5c093612ce896ca8bbaacc8c7c7572ab950f743f # Parent 85957628f4c0fd39c8d3b8316e4584da6d811ab4 DEP-10: add uuid extension to database diff -r 85957628f4c0 -r 5c093612ce89 postgres/Dockerfile --- a/postgres/Dockerfile Wed Apr 06 19:03:16 2016 +0100 +++ b/postgres/Dockerfile Fri Apr 08 21:40:03 2016 +0100 @@ -12,4 +12,8 @@ COPY setupDatabase.sh /docker-entrypoint-initdb.d/setupDatabase.sh -RUN chmod 755 /docker-entrypoint-initdb.d/setupDatabase.sh +COPY setupExtensions.sh /docker-entrypoint-initdb.d/setupExtensions.sh + +RUN chmod 755 /docker-entrypoint-initdb.d/setupDatabase.sh \ + & chmod 755 /docker-entrypoint-initdb.d/setupExtensions.sh + diff -r 85957628f4c0 -r 5c093612ce89 postgres/setupExtensions.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/postgres/setupExtensions.sh Fri Apr 08 21:40:03 2016 +0100 @@ -0,0 +1,14 @@ +#!/bin/bash + +export PGUSER=postgres +TEST=`psql <<- EOSQL + SELECT 1 FROM pg_database WHERE datname='$DB_NAME'; +EOSQL` + +if [[ $TEST == "1" ]]; then + psql $DB_NAME <<- EOSQL + CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; +EOSQL + echo "Set extensions on $DB_NAME" +fi +