X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/d541c6185fb0f426dce0b16e85327b53635169e0..07d66c3691fac5239dfa1f5a8858623ef542c71f:/src/plugins/postgres.sml diff --git a/src/plugins/postgres.sml b/src/plugins/postgres.sml index a267e4f..1689840 100644 --- a/src/plugins/postgres.sml +++ b/src/plugins/postgres.sml @@ -20,12 +20,23 @@ structure Postgres :> POSTGRES = struct -fun adduser user = +fun adduser {user, passwd} = if Slave.shell [Config.Postgres.adduser, user] then NONE else SOME "Error executing CREATE USER script" -val _ = Dbms.register ("postgres", {adduser = adduser}) +fun passwd _ = SOME "We don't use PostgreSQL passwords." + +fun createdb {user, dbname} = + if Slave.shell [Config.Postgres.createdb, user, " ", dbname] then + NONE + else + SOME "Error executing CREATE DATABASE script" + +val _ = Dbms.register ("postgres", {getpass = NONE, + adduser = adduser, + passwd = passwd, + createdb = createdb}) end