source: trunk/new-dns.sql@ 179

Last change on this file since 179 was 2, checked in by Kris Deugau, 15 years ago

/trunk

Import work to date

File size: 3.5 KB
RevLine 
[2]1-- fixme: include template-ish ACL?
2CREATE TABLE groups (
3 group_id SERIAL UNIQUE,
4 parent_group_id int NOT NULL DEFAULT '1',
5 name varchar(255) NOT NULL DEFAULT ''
6);
7-- gotta have a default group to attach some further default data to...
8INSERT INTO groups (name) VALUES ('default');
9
10-- use ON DELETE (CASCADE|RESTRICT|NO ACTION) on FKs
11
12CREATE TABLE domains (
13 domain_id SERIAL UNIQUE,
14 domain varchar(80) NOT NULL PRIMARY KEY,
15 group_id int NOT NULL DEFAULT 1 REFERENCES groups (group_id),
16 description varchar(255) NOT NULL DEFAULT '',
17 status int NOT NULL DEFAULT 1
18);
19
20CREATE TABLE default_records (
21 record_id SERIAL PRIMARY KEY,
22 group_id int NOT NULL DEFAULT 1 REFERENCES groups (group_id),
23 host varchar(100) NOT NULL DEFAULT '',
24 type int NOT NULL DEFAULT 1,
25 val varchar(100) NOT NULL DEFAULT '',
26 distance int NOT NULL DEFAULT 0,
27 weight int NOT NULL DEFAULT 0,
28 port int NOT NULL DEFAULT 0,
29 ttl int NOT NULL DEFAULT 86400,
30 description varchar(255)
31);
32
33-- let's take pity on the poor sod installing things and include some default data that's halfway sane
34INSERT INTO default_records (group_id,host,type,val,ttl) VALUES (1,'ns1.example.com:hostmaster.DOMAIN',6,'10800:3600:604800:10800',86400);
35
36CREATE TABLE records (
37 domain_id int NOT NULL REFERENCES domains (domain_id),
38 record_id SERIAL PRIMARY KEY,
39 host varchar(100) NOT NULL DEFAULT '',
40 type int NOT NULL DEFAULT 1,
41 val varchar(100) NOT NULL DEFAULT '',
42 distance int NOT NULL DEFAULT 0,
43 weight int NOT NULL DEFAULT 0,
44 port int NOT NULL DEFAULT 0,
45 ttl int NOT NULL DEFAULT 86400,
46 description varchar(255)
47);
48
49-- oooo! oooo! allow staff/unwashed-masses parallel users?
50-- - multitable, or just another column in the database...?
51-- - go with column for now (could even overload groups...)
52CREATE TABLE users (
53 user_id SERIAL PRIMARY KEY,
54 group_id int NOT NULL DEFAULT 1 REFERENCES groups (group_id),
55 email varchar(60) NOT NULL,
56 password varchar(34) NOT NULL,
57 firstname varchar(30),
58 lastname varchar(30),
59 phone varchar(15),
60 type char NOT NULL DEFAULT 'S',
61 status int NOT NULL DEFAULT 1,
62 acl varchar(40) NOT NULL DEFAULT 'b'
63);
64
65-- include a default user, so we don't break on install. not happy with this, but...
66-- default password is 'test'
67INSERT INTO users (group_id,email,password,type,status,acl) VALUES (1,'test@test','$1$BByge8u2$48AaGX3YeHplfErX5Tlqa1','S',1,'A');
68
69-- these could be stuffed in a hash, but that gets tedious
70CREATE TABLE rectypes (
71 val int NOT NULL,
72 name varchar(12) NOT NULL,
73 stdflag int NOT NULL DEFAULT 1,
74 listorder int NOT NULL DEFAULT 255,
75 PRIMARY KEY (val,name)
76);
77-- data from http://www.iana.org/assignments/dns-parameters
78COPY rectypes (val, name, stdflag, listorder) FROM stdin;
791 A 1 1
802 NS 1 2
813 MD 2 255
824 MF 2 255
835 CNAME 1 6
846 SOA 0 8
857 MB 3 255
868 MG 3 255
879 MR 3 255
8810 NULL 3 255
8911 WKS 3 255
9012 PTR 2 4
9113 HINFO 3 255
9214 MINFO 3 255
9315 MX 1 3
9416 TXT 1 5
9517 RP 2 255
9618 AFSDB 3 255
9719 X25 3 255
9820 ISDN 3 255
9921 RT 3 255
10022 NSAP 3 255
10123 NSAP-PTR 3 255
10224 SIG 3 255
10325 KEY 3 255
10426 PX 3 255
10527 GPOS 3 255
10628 AAAA 2 2
10729 LOC 3 255
10830 NXT 3 255
10931 EID 3 255
11032 NIMLOC 3 255
11133 SRV 1 7
11234 ATMA 3 255
11335 NAPTR 3 255
11436 KX 3 255
11537 CERT 3 255
11638 A6 3 3
11739 DNAME 3 255
11840 SINK 3 255
11941 OPT 3 255
12042 APL 3 255
12143 DS 3 255
12244 SSHFP 3 255
12345 IPSECKEY 3 255
12446 RRSIG 3 255
12547 NSEC 3 255
12648 DNSKEY 3 255
12749 DHCID 3 255
12850 NSEC3 3 255
12951 NSEC3PARAM 3 255
13055 HIP 3 255
13199 SPF 3 255
132100 UINFO 3 255
133101 UID 3 255
134102 GID 3 255
135103 UNSPEC 3 255
136249 TKEY 3 255
137250 TSIG 3 255
138251 IXFR 3 255
139252 AXFR 3 255
140253 MAILB 3 255
141254 MAILA 3 255
14232768 TA 3 255
14332769 DLV 3 255
144\.
Note: See TracBrowser for help on using the repository browser.