Change dbtool to create user only (and assign tablespace ownership for Postgres)
[hcoop/domtool2.git] / src / plugins / domtool-postgres
index cbc10e9..1d945d4 100755 (executable)
@@ -2,7 +2,10 @@
 
 case $1 in
        adduser)
 
 case $1 in
        adduser)
-               echo Postgres user was already created during create-user.
+               USERNAME=$2
+
+               sudo -u postgres psql -c "CREATE USER $USERNAME" template1
+               sudo -u postgres psql -c "ALTER TABLESPACE user_$USERNAME OWNER TO $USERNAME"
        ;;
        createdb)
                USERNAME=$2
        ;;
        createdb)
                USERNAME=$2