You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
postfixadmin/DATABASE_PGSQL.TXT

138 lines
4.3 KiB
Plaintext

-- Postfix Admin Release 2.x --
----------------------------------------------------------
--
-- Copyright (c) 2002 - 2005 High5!
-- Created by: Mischa Peters <mischa at high5 dot net>
--
-- This is the complete database structure for Postfix Admin.
-- If you are installing from scratch you can use this file otherwise you
-- need to use the TABLE_CHANGES.TXT or TABLE_BACKUP_MX.TXT that comes with Postfix Admin.
-- You can find these in DOCUMENTS/
--
-- There are 2 entries for a database user in the file.
-- One you can use for Postfix and one for Postfix Admin.
--
-- You can create the database from the shell with:
-- createuser -P postfix
-- createuser -P postfixadmin
-- createdb postfix
-- psql postfix
-- postfix=# \i postfix.sql
-- postfix=# \q
-- exit
--
-- Postfix / PgSQL
--
DROP TABLE admin,alias,domain,domain_admins,log,mailbox CASCADE;
--
--
-- Table structure for table domain
--
CREATE TABLE domain (
domain character varying(255) NOT NULL,
description character varying(255) NOT NULL default '',
aliases integer NOT NULL default 0,
mailboxes integer NOT NULL default 0,
maxquota integer NOT NULL default 0,
quota integer NOT NULL default 0,
transport character varying(255) default NULL,
backupmx boolean NOT NULL default false,
created timestamp with time zone default now(),
modified timestamp with time zone default now(),
active boolean NOT NULL default true,
Constraint "domain_key" Primary Key ("domain")
);
CREATE INDEX domain_domain_active ON domain(domain,active);
COMMENT ON TABLE domain IS 'Postfix Admin - Virtual Domains';
--
-- Table structure for table admin
--
CREATE TABLE "admin" (
"username" character varying(255) NOT NULL,
"password" character varying(255) NOT NULL default '',
"created" timestamp with time zone default now(),
"modified" timestamp with time zone default now(),
"active" boolean NOT NULL default true,
Constraint "admin_key" Primary Key ("username")
);
COMMENT ON TABLE admin IS 'Postfix Admin - Virtual Admins';
--
-- Table structure for table alias
--
CREATE TABLE alias (
address character varying(255) NOT NULL,
goto text NOT NULL,
domain character varying(255) NOT NULL REFERENCES domain,
created timestamp with time zone default now(),
modified timestamp with time zone default now(),
active boolean NOT NULL default true,
Constraint "alias_key" Primary Key ("address")
);
CREATE INDEX alias_address_active ON alias(address,active);
COMMENT ON TABLE alias IS 'Postfix Admin - Virtual Aliases';
--
-- Table structure for table domain_admins
--
CREATE TABLE domain_admins (
username character varying(255) NOT NULL,
domain character varying(255) NOT NULL REFERENCES domain,
created timestamp with time zone default now(),
active boolean NOT NULL default true
);
COMMENT ON TABLE domain_admins IS 'Postfix Admin - Domain Admins';
--
-- Table structure for table log
--
CREATE TABLE log (
timestamp timestamp with time zone default now(),
username character varying(255) NOT NULL default '',
domain character varying(255) NOT NULL default '',
action character varying(255) NOT NULL default '',
data text NOT NULL default ''
);
COMMENT ON TABLE log IS 'Postfix Admin - Log';
--
-- Table structure for table mailbox
--
CREATE TABLE mailbox (
username character varying(255) NOT NULL,
password character varying(255) NOT NULL default '',
name character varying(255) NOT NULL default '',
maildir character varying(255) NOT NULL default '',
quota integer NOT NULL default 0,
domain character varying(255) NOT NULL REFERENCES domain,
created timestamp with time zone default now(),
modified timestamp with time zone default now(),
active boolean NOT NULL default true,
Constraint "mailbox_key" Primary Key ("username")
);
CREATE INDEX mailbox_username_active ON mailbox(username,active);
COMMENT ON TABLE mailbox IS 'Postfix Admin - Virtual Mailboxes';
GRANT
SELECT,INSERT,UPDATE,DELETE
ON
admin,
alias,
domain,
domain_admins,
log,
mailbox,
TO postfixadmin;
GRANT SELECT ON alias,domain,mailbox TO postfix;
-- superadmin user & password (login: admin@domain.tld, password: admin)
INSERT INTO domain (domain) VALUES ('ALL');
INSERT INTO domain_admins (username, domain, active) VALUES ('admin@domain.tld','ALL','1');
INSERT INTO admin (username, password, active) VALUES ('admin@domain.tld','$1$0fec9189$bgI6ncWrldPOsXnkUBIjl1','1');