
DROP TABLE vmail_domain ;
CREATE TABLE vmail_domain (
    id SERIAL,
    name character varying(100) NOT NULL,
    sys_user character varying(10) NOT NULL,
    sys_edit timestamp without time zone NOT NULL
);

CREATE UNIQUE INDEX vmail_domain_id ON vmail_domain USING btree (id);

REVOKE ALL ON TABLE vmail_user FROM PUBLIC;
REVOKE ALL ON TABLE vmail_user FROM joey;
GRANT ALL ON TABLE vmail_user TO joey;
GRANT ALL ON TABLE vmail_user TO "www-data";

REVOKE ALL ON SEQUENCE vmail_user_id_seq FROM PUBLIC;
REVOKE ALL ON SEQUENCE vmail_user_id_seq FROM joey;
GRANT ALL ON SEQUENCE vmail_user_id_seq TO joey;
GRANT ALL ON SEQUENCE vmail_user_id_seq TO "www-data";

REVOKE ALL ON TABLE vmail_domain FROM PUBLIC;
REVOKE ALL ON TABLE vmail_domain FROM joey;
GRANT ALL ON TABLE vmail_domain TO joey;
GRANT ALL ON TABLE vmail_domain TO "www-data";

REVOKE ALL ON SEQUENCE vmail_domain_id_seq FROM PUBLIC;
REVOKE ALL ON SEQUENCE vmail_domain_id_seq FROM joey;
GRANT ALL ON SEQUENCE vmail_domain_id_seq TO joey;
GRANT ALL ON SEQUENCE vmail_domain_id_seq TO "www-data";

INSERT INTO vmail_domain (name,sys_user,sys_edit) VALUES ('crossvoid.de','joey',now());
