Specifying encoding on database creation
[hcoop/domtool2.git] / src / plugins / domtool-postgres
index fed7bbe..214e9ac 100755 (executable)
@@ -11,9 +11,14 @@ case $1 in
        createdb)
                USERNAME=$2
                DBNAME_BASE=$3
+               ENCODING=$4
                DBNAME="${USERNAME}_${DBNAME_BASE}"
 
-               sudo -u postgres createdb -O $USERNAME -D user_$USERNAME $DBNAME
+               if [ -n $ENCODING ]; then
+                   ENCODING="-E $ENCODING"
+               fi
+
+               sudo -u postgres createdb -O $USERNAME -D user_$USERNAME $ENCODING $DBNAME
        ;;
 
        dropdb)