1
0
Fork 0
gnuviechadmin-historic/backend/docs/dbschema.sql

178 lines
4.5 KiB
MySQL
Raw Normal View History

--
-- PostgreSQL database dump
--
SET client_encoding = 'UNICODE';
SET check_function_bodies = false;
SET SESSION AUTHORIZATION 'postgres';
BEGIN;
--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
GRANT ALL ON SCHEMA public TO PUBLIC;
SET SESSION AUTHORIZATION 'gnuviech';
SET search_path = public, pg_catalog;
--
-- Name: country; Type: TABLE; Schema: public; Owner: gnuviech
--
CREATE TABLE country (
countryid serial PRIMARY KEY,
name character varying(40) NOT NULL
);
REVOKE ALL ON TABLE country FROM PUBLIC;
--
-- Name: reseller; Type: TABLE; Schema: public; Owner: gnuviech
--
CREATE TABLE reseller (
resellerid serial PRIMARY KEY,
name character varying(40) NOT NULL
);
REVOKE ALL ON TABLE reseller FROM PUBLIC;
--
-- Name: client; Type: TABLE; Schema: public; Owner: gnuviech
--
CREATE TABLE client (
clientid serial PRIMARY KEY,
firstname character varying(40) NOT NULL,
lastname character varying(40) NOT NULL,
address1 character varying(40) NOT NULL,
address2 character varying(40),
countryid integer NOT NULL REFERENCES country(countryid),
town character varying(50) NOT NULL,
zipcode character(5) NOT NULL,
state character varying(40),
active boolean DEFAULT false NOT NULL,
phone character varying(20),
mobile character varying(20),
reseller_id integer REFERENCES reseller(resellerid),
organisation character varying(200)
);
REVOKE ALL ON TABLE client FROM PUBLIC;
--
-- Name: email; Type: TABLE; Schema: public; Owner: gnuviech
--
CREATE TABLE email (
emailid serial PRIMARY KEY,
email character varying(128) NOT NULL,
clientid integer NOT NULL REFERENCES client(clientid),
verified boolean DEFAULT false NOT NULL
);
REVOKE ALL ON TABLE email FROM PUBLIC;
--
-- Name: sysuser; Type: TABLE; Schema: public; Owner: gnuviech
--
CREATE TABLE sysuser (
sysuserid serial PRIMARY KEY,
name character varying(12) NOT NULL,
"type" integer DEFAULT 0 NOT NULL,
home character varying(128),
shell boolean,
"password" character varying(64),
clientid integer NOT NULL REFERENCES client(clientid),
toupdate boolean DEFAULT false NOT NULL,
md5pass character varying(32),
sysuid integer UNIQUE
);
REVOKE ALL ON TABLE sysuser FROM PUBLIC;
GRANT SELECT ON TABLE sysuser TO GROUP services;
--
-- Name: domain; Type: TABLE; Schema: public; Owner: gnuviech
--
CREATE TABLE "domain" (
domainid serial PRIMARY KEY,
domainname character varying(64) NOT NULL,
clientid integer NOT NULL REFERENCES client(clientid),
status integer DEFAULT 0 NOT NULL,
sysuserid integer NOT NULL REFERENCES sysuser(sysuserid)
);
REVOKE ALL ON TABLE "domain" FROM PUBLIC;
GRANT SELECT ON TABLE "domain" TO GROUP services;
--
-- Name: zone; Type: TABLE; Schema: public; Owner: gnuviech
--
CREATE TABLE "zone" (
zoneid serial PRIMARY KEY,
"domain" integer NOT NULL REFERENCES domain(domainid),
"type" character varying(5) NOT NULL,
ttl integer NOT NULL,
mxprio integer,
resource character varying(256),
toupdate boolean DEFAULT false NOT NULL
);
REVOKE ALL ON TABLE "zone" FROM PUBLIC;
--
-- Name: mailpasswd; Type: TABLE; Schema: public; Owner: gnuviech
--
CREATE TABLE mailpasswd (
id character varying(128) NOT NULL,
crypt character varying(128) DEFAULT '' NOT NULL,
clear character varying(128) DEFAULT '' NOT NULL,
name character varying(128) DEFAULT '' NOT NULL,
uid integer DEFAULT 65534 NOT NULL,
gid integer DEFAULT 65534 NOT NULL,
home character varying(255) DEFAULT '' NOT NULL,
maildir character varying(255) DEFAULT '' NOT NULL,
defaultdelivery character varying(255) DEFAULT '' NOT NULL,
quota character varying(255) DEFAULT '' NOT NULL,
spamcheck boolean DEFAULT false NOT NULL,
sajunkscore integer
);
REVOKE ALL ON TABLE mailpasswd FROM PUBLIC;
GRANT ALL ON TABLE mailpasswd TO GROUP services;
--
-- Name: mailalias; Type: TABLE; Schema: public; Owner: gnuviech
--
CREATE TABLE mailalias (
email character varying(255) NOT NULL,
"domain" character varying(255) NOT NULL,
target character varying(255) NOT NULL
);
REVOKE ALL ON TABLE mailalias FROM PUBLIC;
GRANT ALL ON TABLE mailalias TO GROUP services;
--
-- Name: country; Type: TABLE DATA; Schema: public; Owner: gnuviech
--
INSERT INTO country (countryid, name) VALUES (1, 'Deutschland');
INSERT INTO country (countryid, name) VALUES (2, 'Schweiz');
INSERT INTO country (countryid, name) VALUES (3, 'Österreich');
SET SESSION AUTHORIZATION 'postgres';
COMMIT;