-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdb_schema.txt
129 lines (114 loc) · 2.67 KB
/
db_schema.txt
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
DROP TABLE certificate_tree;
DROP TABLE resource_certificate;
DROP TABLE roa;
DROP TABLE manifest;
DROP TABLE crl;
CREATE TYPE roaprefix AS(
prefix cidr,
maxlen int8
);
CREATE OR REPLACE FUNCTION roaprefix(
cidr,
int8
) RETURNS roaprefix AS
$$
SELECT ($1,$2)::roaprefix;
$$
LANGUAGE 'sql' IMMUTABLE STRICT
COST 1;
CREATE OR REPLACE FUNCTION roaprefix_overlaps(inet, roaprefix)
RETURNS boolean AS
$$
SELECT ($1) >>= ($2).prefix OR ($1) <<= ($2).prefix;
$$
LANGUAGE 'sql' IMMUTABLE;
CREATE OR REPLACE FUNCTION roaprefix_overlaps(roaprefix, inet)
RETURNS boolean AS
$$
SELECT ($2) >>= ($1).prefix OR ($2) <<= ($1).prefix;
$$
LANGUAGE 'sql' IMMUTABLE;
CREATE OPERATOR @> (
LEFTARG = roaprefix,
RIGHTARG = inet,
PROCEDURE = roaprefix_overlaps
);
CREATE OPERATOR <@ (
LEFTARG = inet,
RIGHTARG = roaprefix,
PROCEDURE = roaprefix_overlaps
);
CREATE TABLE certificate_tree (
tree_name text NOT NULL,
date timestamp NOT NULL,
trust_anchor_name text PRIMARY KEY,
UNIQUE (tree_name)
);
CREATE TABLE resource_certificate (
certificate_name text PRIMARY KEY,
subject text,
serial_nr numeric,
issuer text,
subject_key_identifier text,
authority_key_identifier text,
public_key text,
isEE boolean,
isCA boolean,
isRoot boolean,
validity_period_start timestamp,
validity_period_end timestamp,
is_valid boolean,
validation_errors text[],
validation_warnings text[],
prefixes cidr[],
asns bigint[],
asn_ranges int8range[],
manifest text,
crl text,
parent_certificate text,
certificate_tree text NOT NULL,
id bigint,
parent_id bigint,
has_kids boolean
);
CREATE TABLE roa (
roa_name text PRIMARY KEY,
asn numeric,
validity_period_start timestamp,
validity_period_end timestamp,
is_valid boolean,
validation_errors text[],
validation_warnings text[],
signing_time timestamp,
prefixes roaprefix[],
parent_certificate text,
certificate_tree text NOT NULL,
id bigint,
parent_id bigint
);
CREATE TABLE manifest (
manifest_name text PRIMARY KEY,
files text[],
validity_period_start timestamp,
validity_period_end timestamp,
is_valid boolean,
validation_errors text[],
validation_warnings text[],
parent_certificate text,
certificate_tree text NOT NULL,
id numeric,
parent_id bigint
);
CREATE TABLE crl (
crl_name text PRIMARY KEY,
revoked_objects text[],
validity_period_start timestamp,
validity_period_end timestamp,
is_valid boolean,
validation_errors text[],
validation_warnings text[],
parent_certificate text,
certificate_tree text NOT NULL,
id numeric,
parent_id bigint
);