diff --git a/DATABASE_MYSQL.TXT b/DATABASE_MYSQL.TXT index 86b5cefd..5bb4fc29 100644 --- a/DATABASE_MYSQL.TXT +++ b/DATABASE_MYSQL.TXT @@ -123,6 +123,35 @@ CREATE TABLE `mailbox` ( ) TYPE=MyISAM COMMENT='Postfix Admin - Virtual Mailboxes'; +# +# Vacation stuff ... +# +DROP TABLE IF EXISTS vacation; +DROP TABLE IF EXISTS vacation_notification; +CREATE TABLE vacation ( + email varchar(255) NOT NULL default '', + subject varchar(255) NOT NULL default '', + body text NOT NULL, + cache text NOT NULL, + domain varchar(255) NOT NULL default '', + created datetime NOT NULL default '0000-00-00 00:00:00', + active tinyint(4) NOT NULL default '1', + PRIMARY KEY (email), + KEY email (email) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci TYPE=InnoDB COMMENT='Postfix Admin - Virtual Vacation' ; + +# vacation_notification table + +CREATE TABLE vacation_notification ( + on_vacation varchar(255) NOT NULL, + notified varchar(255) NOT NULL, + notified_at timestamp NOT NULL default now(), + CONSTRAINT vacation_notification_pkey PRIMARY KEY(on_vacation, notified), + FOREIGN KEY (on_vacation) REFERENCES vacation(email) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci TYPE=InnoDB COMMENT='Postfix Admin - Virtual Vacation Notifications'; + +# +# # superadmin user & password (login: admin@domain.tld, password: admin) 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'); diff --git a/DATABASE_PGSQL.TXT b/DATABASE_PGSQL.TXT index 9efa3bb8..d5d5165f 100644 --- a/DATABASE_PGSQL.TXT +++ b/DATABASE_PGSQL.TXT @@ -15,6 +15,7 @@ -- You can create the database from the shell with: -- createuser -P postfix -- createuser -P postfixadmin +-- createuser -P vacation -- createdb postfix -- psql postfix -- postfix=# \i postfix.sql @@ -130,7 +131,44 @@ TO postfixadmin; GRANT SELECT ON alias,domain,mailbox TO postfix; +-- Vacation Stuff ... +DROP TABLE vacation,vacation_notification CASCADE; + +CREATE TABLE vacation ( + email character varying(255) PRIMARY KEY, + subject character varying(255) NOT NULL DEFAULT '', + body text NOT NULL DEFAULT '', + cache text NOT NULL DEFAULT '', + "domain" character varying(255) NOT NULL REFERENCES "domain", + created timestamp with time zone DEFAULT now(), + active boolean DEFAULT true NOT NULL +); +CREATE INDEX vacation_email_active ON vacation(email,active); + +CREATE TABLE vacation_notification ( + on_vacation character varying(255) NOT NULL REFERENCES vacation(email) ON DELETE CASCADE, + notified character varying(255) NOT NULL, + notified_at timestamp with time zone NOT NULL DEFAULT now(), + CONSTRAINT vacation_notification_pkey primary key(on_vacation,notified) +); +-- Note: It's important that the primary key constraint on vacation_notification +-- be given a name which includes the '_pkey' substring (default PostgreSQL naming +-- for primary keys). The vacation-script looks for this substring to +-- distinguish between an acceptable and non-acceptable error. + + +GRANT + SELECT,INSERT,UPDATE,DELETE +ON + vacation +TO postfixadmin; + +GRANT SELECT ON vacation TO vacation; +GRANT SELECT,INSERT,DELETE ON vacation_notification TO vacation; + +-- +-- -- 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');