X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/35659203a708078cdec25ff74adbe1e9168934d6..5ad00addff68d8957629499e019c4a001051aca4:/src/plugins/domtool-postgres diff --git a/src/plugins/domtool-postgres b/src/plugins/domtool-postgres index 1d945d4..fed7bbe 100755 --- a/src/plugins/domtool-postgres +++ b/src/plugins/domtool-postgres @@ -7,6 +7,7 @@ case $1 in sudo -u postgres psql -c "CREATE USER $USERNAME" template1 sudo -u postgres psql -c "ALTER TABLESPACE user_$USERNAME OWNER TO $USERNAME" ;; + createdb) USERNAME=$2 DBNAME_BASE=$3 @@ -14,7 +15,16 @@ case $1 in sudo -u postgres createdb -O $USERNAME -D user_$USERNAME $DBNAME ;; + + dropdb) + USERNAME=$2 + DBNAME_BASE=$3 + DBNAME="${USERNAME}_${DBNAME_BASE}" + + sudo -u postgres dropdb $DBNAME + ;; + *) - echo "Usage: domtool-postgres [adduser | createdb ]" + echo "Usage: domtool-postgres [adduser | createdb | dropdb ]" ;; esac