forked from tobbez/dnsstatd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
52 lines (42 loc) · 1.02 KB
/
schema.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
DROP TABLE IF EXISTS dnsstatd_question;
DROP TABLE IF EXISTS dnsstatd_resource_record;
DROP TABLE IF EXISTS dnsstatd_response;
DROP TABLE IF EXISTS dnsstatd_failure;
/* One response packet */
CREATE TABLE dnsstatd_response (
id BIGSERIAL PRIMARY KEY,
hdrid INT,
ts TIMESTAMP,
rcode SMALLINT,
aa BOOL,
tc BOOL,
rd BOOL,
ra BOOL,
client INET,
server INET
);
/* Contains resource records from responses */
CREATE TABLE dnsstatd_resource_record (
id BIGSERIAL PRIMARY KEY,
response BIGINT NOT NULL REFERENCES dnsstatd_response (id) ON DELETE CASCADE,
name TEXT,
type INT,
class INT,
ttl BIGINT,
rdata TEXT
);
/* Contains information from the question section in a responses */
CREATE TABLE dnsstatd_question (
id BIGSERIAL PRIMARY KEY,
response BIGINT NOT NULL REFERENCES dnsstatd_response (id) ON DELETE CASCADE,
name TEXT,
type INT,
class INT
);
/* Used for logging packets that dnsstatd failed to parse */
CREATE TABLE dnsstatd_failure (
id BIGSERIAL PRIMARY KEY,
ts TIMESTAMP,
error TEXT,
packet TEXT
);