Create postgresql 9.1 tablespaces for users
authorclinton_admin <clinton_admin@navajos.hcoop.net>
Thu, 20 Dec 2012 08:26:46 +0000 (03:26 -0500)
committerclinton_admin <clinton_admin@navajos.hcoop.net>
Thu, 20 Dec 2012 08:26:46 +0000 (03:26 -0500)
create-user-database

index bc2ca60..22a4b86 100755 (executable)
@@ -8,15 +8,24 @@ USER=$1
 PATHBITS=`echo $USER | head -c 1`/`echo $USER | head -c 2`/$USER
 DBPATH=/srv/databases/$PATHBITS
 PGDIR=$DBPATH/postgres
+PGNEWDIR="$DBPATH/postgres-9.1"
 MYSQLDIR=$DBPATH/mysql
 
 # Create postgres user and tablespace placeholder within volume
 # FIXME: This assumes the status-quo of database accounts not being
 # removed by destroy-user...
 if ! test -d $PGDIR; then
+# postgres 8.1
   mkdir -p $PGDIR
   chown postgres:postgres $PGDIR
-  sudo -u postgres psql -c "CREATE TABLESPACE \"user_$USER\" OWNER postgres LOCATION '$PGDIR'" template1
+  sudo -u postgres psql --cluster 8.1/main -c "CREATE TABLESPACE \"user_$USER\" OWNER postgres LOCATION '$PGDIR'" template1
+fi
+
+if ! test -d $PGNEWDIR; then
+# postgres 9.1
+  mkdir -p $PGNEWDIR
+  chown postgres:postgres $PGNEWDIR
+  sudo -u postgres psql --cluster 9.1/main -c "CREATE TABLESPACE \"user_$USER\" OWNER postgres LOCATION '$PGNEWDIR'" template1
 fi
 
 # Create mysql user and databases placeholder within volume