CREATE USER 'vmail' PASSWORD 'vmail';
CREATE DATABASE vmail;
GRANT ALL PRIVILEGES ON DATABASE vmail TO vmail;
\c vmail
GRANT ALL ON SCHEMA public TO vmail;

CREATE TABLE aliases (
    alias text NOT NULL,
    email text NOT NULL
);

CREATE TABLE users (
    username text NOT NULL,
    domain text NOT NULL,
    created timestamp with time zone DEFAULT now(),
    password text NOT NULL
);

INSERT INTO users ( username, domain, password) VALUES ( 'roman', 'mail-ost.ch','{SHA512}G6gTKS1x+Z5k7z3Cb3FcIFgB+k8fGSMmd5+pJbntINZWmBvzZieelZEop9Tq6oeF3PI8VadlmFwjdGDyDh7rRQ==');
INSERT INTO aliases ( email, alias ) VALUES ( 'roman@mail-ost.ch', 'roman2@mail-ost.ch');

CREATE USER 'postfix' PASSWORD 'postfix';
CREATE DATABASE postfix;
GRANT ALL PRIVILEGES ON DATABASE postfix TO postfix;