annotate postgres/setupExtensions.sh @ 80:5c093612ce89

DEP-10: add uuid extension to database
author smith@nwoca.org
date Fri, 08 Apr 2016 21:40:03 +0100
parents postgres/setupDatabase.sh@0cdc167e6319
children 53671513b240
rev   line source
3
0cdc167e6319 DEP-2: postgres dockerfile
smith@nwoca.org
parents:
diff changeset
1 #!/bin/bash
0cdc167e6319 DEP-2: postgres dockerfile
smith@nwoca.org
parents:
diff changeset
2
0cdc167e6319 DEP-2: postgres dockerfile
smith@nwoca.org
parents:
diff changeset
3 export PGUSER=postgres
0cdc167e6319 DEP-2: postgres dockerfile
smith@nwoca.org
parents:
diff changeset
4 TEST=`psql <<- EOSQL
0cdc167e6319 DEP-2: postgres dockerfile
smith@nwoca.org
parents:
diff changeset
5 SELECT 1 FROM pg_database WHERE datname='$DB_NAME';
0cdc167e6319 DEP-2: postgres dockerfile
smith@nwoca.org
parents:
diff changeset
6 EOSQL`
0cdc167e6319 DEP-2: postgres dockerfile
smith@nwoca.org
parents:
diff changeset
7
0cdc167e6319 DEP-2: postgres dockerfile
smith@nwoca.org
parents:
diff changeset
8 if [[ $TEST == "1" ]]; then
80
5c093612ce89 DEP-10: add uuid extension to database
smith@nwoca.org
parents: 3
diff changeset
9 psql $DB_NAME <<- EOSQL
5c093612ce89 DEP-10: add uuid extension to database
smith@nwoca.org
parents: 3
diff changeset
10 CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
3
0cdc167e6319 DEP-2: postgres dockerfile
smith@nwoca.org
parents:
diff changeset
11 EOSQL
80
5c093612ce89 DEP-10: add uuid extension to database
smith@nwoca.org
parents: 3
diff changeset
12 echo "Set extensions on $DB_NAME"
3
0cdc167e6319 DEP-2: postgres dockerfile
smith@nwoca.org
parents:
diff changeset
13 fi
0cdc167e6319 DEP-2: postgres dockerfile
smith@nwoca.org
parents:
diff changeset
14