apache: remove php5-cgi support, always generate php config
[hcoop/domtool2.git] / src / plugins / postgres.sml
CommitLineData
d541c618
AC
1(* HCoop Domtool (http://hcoop.sourceforge.net/)
2 * Copyright (c) 2006, Adam Chlipala
617696c6 3 * Copyright (c) 2012 Clinton Ebadi <clinton@unknownlamer.org>
d541c618
AC
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *)
19
20(* PostgreSQL user/table management *)
21
22structure Postgres :> POSTGRES = struct
23
a92add46 24fun adduser port {user, passwd} =
611f7186 25 Option.map (fn s => "Error executing CREATE USER script:\n" ^ s)
a92add46 26 (Slave.shellOutput [Config.Postgres.adduser, " ", port, " ", user])
d541c618 27
86aa5de7
AC
28fun passwd _ = SOME "We don't use PostgreSQL passwords."
29
a92add46 30fun createdb port {user, dbname, encoding} =
611f7186 31 Option.map (fn s => "Error executing CREATE DATABASE script:\n" ^ s)
fe789bea 32 (Slave.shellOutput [Config.Postgres.createdb,
a92add46 33 " ", port, " ", user, " ", dbname,
fe789bea 34 case encoding of NONE => "" | SOME e => " " ^ e])
90dd48df 35
a92add46 36fun dropdb port {user, dbname} =
611f7186 37 Option.map (fn s => "Error executing DROP DATABASE script:\n" ^ s)
a92add46 38 (Slave.shellOutput [Config.Postgres.dropdb, " ", port, " ", user, " ", dbname])
35659203 39
21d921a5 40val _ = Dbms.register ("postgres", {getpass = NONE,
a92add46 41 adduser = adduser Config.Postgres.postgres81port,
86aa5de7 42 passwd = passwd,
a92add46
CE
43 createdb = createdb Config.Postgres.postgres81port,
44 dropdb = dropdb Config.Postgres.postgres81port,
99cc4144 45 grant = fn _ => SOME "You don't need to use GRANT for Postgres."})
d541c618 46
a92add46
CE
47val _ = Dbms.register ("postgres-9.1", {getpass = NONE,
48 adduser = adduser Config.Postgres.postgres91port,
49 passwd = passwd,
50 createdb = createdb Config.Postgres.postgres91port,
51 dropdb = dropdb Config.Postgres.postgres91port,
52 grant = fn _ => SOME "You don't need to use GRANT for Postgres."})
53
d541c618 54end