2021-01-06 20:38:55 +00:00
|
|
|
CREATE DATABASE mail OWNER postgres;
|
|
|
|
CREATE TABLE users (
|
|
|
|
userid VARCHAR(128) NOT NULL,
|
|
|
|
password VARCHAR(128) NOT NULL,
|
|
|
|
active boolean NOT NULL,
|
|
|
|
PRIMARY KEY (userid),
|
|
|
|
UNIQUE (userid)
|
|
|
|
);
|
|
|
|
CREATE TABLE aliases (
|
|
|
|
target VARCHAR(128) NOT NULL,
|
|
|
|
alias VARCHAR(128) NOT NULL,
|
|
|
|
active boolean NOT NULL,
|
2021-01-07 17:13:22 +00:00
|
|
|
PRIMARY KEY (alias),
|
|
|
|
UNIQUE (alias)
|
2021-01-06 20:38:55 +00:00
|
|
|
);
|
2021-01-07 17:13:22 +00:00
|
|
|
CREATE ROLE dovecot PASSWORD 'CHANGEME' LOGIN;
|
|
|
|
GRANT SELECT ON TABLE users TO dovecot;
|
|
|
|
CREATE ROLE postfix PASSWORD 'CHANGEME' LOGIN;
|
|
|
|
GRANT SELECT ON TABLE users, aliases TO postfix;
|