basic database structure
git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@17 a67ec6bc-e5d5-0310-a910-815c51eb3124
This commit is contained in:
parent
d4a2c85f9d
commit
438b4eff87
1 changed files with 333 additions and 0 deletions
333
database.sql
Normal file
333
database.sql
Normal file
|
@ -0,0 +1,333 @@
|
|||
--
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
|
||||
\connect - gnuviech
|
||||
|
||||
SET search_path = public, pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 2 (OID 16981)
|
||||
-- Name: country; Type: TABLE; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
CREATE TABLE country (
|
||||
id integer NOT NULL,
|
||||
name character varying(40) NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 3 (OID 16993)
|
||||
-- Name: client; Type: TABLE; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
CREATE TABLE client (
|
||||
id integer NOT NULL,
|
||||
firstname character varying(40) NOT NULL,
|
||||
lastname character varying(40) NOT NULL,
|
||||
address1 character varying(40) NOT NULL,
|
||||
address2 character varying(40),
|
||||
country integer NOT NULL,
|
||||
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
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 4 (OID 17004)
|
||||
-- Name: reseller; Type: TABLE; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
CREATE TABLE reseller (
|
||||
id integer NOT NULL,
|
||||
name character varying(40) NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 5 (OID 17015)
|
||||
-- Name: email; Type: TABLE; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
CREATE TABLE email (
|
||||
id integer NOT NULL,
|
||||
email character varying(128) NOT NULL,
|
||||
client integer,
|
||||
verified boolean DEFAULT false NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 6 (OID 17026)
|
||||
-- Name: sysuser; Type: TABLE; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
CREATE TABLE sysuser (
|
||||
id integer NOT NULL,
|
||||
name character varying(12) NOT NULL,
|
||||
"type" integer DEFAULT 0 NOT NULL,
|
||||
home character varying(128),
|
||||
shell boolean,
|
||||
"password" character varying(64),
|
||||
client integer NOT NULL,
|
||||
toupdate boolean DEFAULT false NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 7 (OID 17038)
|
||||
-- Name: domain; Type: TABLE; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
CREATE TABLE "domain" (
|
||||
id integer NOT NULL,
|
||||
domainname character varying(64) NOT NULL,
|
||||
client integer NOT NULL,
|
||||
status integer DEFAULT 0 NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 8 (OID 17047)
|
||||
-- Name: zone; Type: TABLE; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
CREATE TABLE "zone" (
|
||||
id integer NOT NULL,
|
||||
"domain" integer NOT NULL,
|
||||
"type" character varying(5) NOT NULL,
|
||||
ttl integer NOT NULL,
|
||||
mxprio integer,
|
||||
resource character varying(256),
|
||||
toupdate boolean DEFAULT false NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Data for TOC entry 21 (OID 16981)
|
||||
-- Name: country; Type: TABLE DATA; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
COPY country (id, name) FROM stdin;
|
||||
\.
|
||||
|
||||
|
||||
--
|
||||
-- Data for TOC entry 22 (OID 16993)
|
||||
-- Name: client; Type: TABLE DATA; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
COPY client (id, firstname, lastname, address1, address2, country, town, zipcode, state, active, phone, mobile, reseller_id) FROM stdin;
|
||||
\.
|
||||
|
||||
|
||||
--
|
||||
-- Data for TOC entry 23 (OID 17004)
|
||||
-- Name: reseller; Type: TABLE DATA; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
COPY reseller (id, name) FROM stdin;
|
||||
\.
|
||||
|
||||
|
||||
--
|
||||
-- Data for TOC entry 24 (OID 17015)
|
||||
-- Name: email; Type: TABLE DATA; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
COPY email (id, email, client, verified) FROM stdin;
|
||||
\.
|
||||
|
||||
|
||||
--
|
||||
-- Data for TOC entry 25 (OID 17026)
|
||||
-- Name: sysuser; Type: TABLE DATA; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
COPY sysuser (id, name, "type", home, shell, "password", client, toupdate) FROM stdin;
|
||||
\.
|
||||
|
||||
|
||||
--
|
||||
-- Data for TOC entry 26 (OID 17038)
|
||||
-- Name: domain; Type: TABLE DATA; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
COPY "domain" (id, domainname, client, status) FROM stdin;
|
||||
\.
|
||||
|
||||
|
||||
--
|
||||
-- Data for TOC entry 27 (OID 17047)
|
||||
-- Name: zone; Type: TABLE DATA; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
COPY "zone" (id, "domain", "type", ttl, mxprio, resource, toupdate) FROM stdin;
|
||||
\.
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 12 (OID 17012)
|
||||
-- Name: reseller_name_idx; Type: INDEX; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
CREATE UNIQUE INDEX reseller_name_idx ON reseller USING btree (name);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 9 (OID 17014)
|
||||
-- Name: country_name_idx; Type: INDEX; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
CREATE UNIQUE INDEX country_name_idx ON country USING btree (name);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 18 (OID 17037)
|
||||
-- Name: sysuser_type_idx; Type: INDEX; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
CREATE INDEX sysuser_type_idx ON sysuser USING btree ("type");
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 10 (OID 16983)
|
||||
-- Name: country_pkey; Type: CONSTRAINT; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY country
|
||||
ADD CONSTRAINT country_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 11 (OID 16995)
|
||||
-- Name: client_pkey; Type: CONSTRAINT; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY client
|
||||
ADD CONSTRAINT client_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 28 (OID 16997)
|
||||
-- Name: $1; Type: CONSTRAINT; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY client
|
||||
ADD CONSTRAINT "$1" FOREIGN KEY (country) REFERENCES country(id) ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 13 (OID 17006)
|
||||
-- Name: reseller_pkey; Type: CONSTRAINT; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY reseller
|
||||
ADD CONSTRAINT reseller_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 29 (OID 17008)
|
||||
-- Name: $2; Type: CONSTRAINT; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY client
|
||||
ADD CONSTRAINT "$2" FOREIGN KEY (reseller_id) REFERENCES reseller(id) ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 15 (OID 17018)
|
||||
-- Name: email_pkey; Type: CONSTRAINT; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY email
|
||||
ADD CONSTRAINT email_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 14 (OID 17020)
|
||||
-- Name: email_email_key; Type: CONSTRAINT; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY email
|
||||
ADD CONSTRAINT email_email_key UNIQUE (email);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 30 (OID 17022)
|
||||
-- Name: $1; Type: CONSTRAINT; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY email
|
||||
ADD CONSTRAINT "$1" FOREIGN KEY (client) REFERENCES client(id) ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 17 (OID 17029)
|
||||
-- Name: sysuser_pkey; Type: CONSTRAINT; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY sysuser
|
||||
ADD CONSTRAINT sysuser_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 16 (OID 17031)
|
||||
-- Name: sysuser_name_key; Type: CONSTRAINT; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY sysuser
|
||||
ADD CONSTRAINT sysuser_name_key UNIQUE (name);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 31 (OID 17033)
|
||||
-- Name: $1; Type: CONSTRAINT; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY sysuser
|
||||
ADD CONSTRAINT "$1" FOREIGN KEY (client) REFERENCES client(id) ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 19 (OID 17041)
|
||||
-- Name: domain_pkey; Type: CONSTRAINT; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY "domain"
|
||||
ADD CONSTRAINT domain_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 32 (OID 17043)
|
||||
-- Name: $1; Type: CONSTRAINT; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY "domain"
|
||||
ADD CONSTRAINT "$1" FOREIGN KEY (client) REFERENCES client(id) ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 20 (OID 17050)
|
||||
-- Name: zone_pkey; Type: CONSTRAINT; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY "zone"
|
||||
ADD CONSTRAINT zone_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 33 (OID 17052)
|
||||
-- Name: $1; Type: CONSTRAINT; Schema: public; Owner: gnuviech
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY "zone"
|
||||
ADD CONSTRAINT "$1" FOREIGN KEY ("domain") REFERENCES "domain"(id) ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
|
||||
|
Loading…
Reference in a new issue