aboutsummaryrefslogtreecommitdiff
path: root/docs/sample-irdb.sql
blob: abfba9e5490ab84806180c4d155f23421c1c91b1 (plain) (blame)
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
-- $Id$

DROP TABLE IF EXISTS registrant;

CREATE TABLE registrant (
       registrant_id        SERIAL NOT NULL,
       IRBE_mapped_id       TEXT,
       subject_name         TEXT,
       valid_until          DATETIME NOT NULL,
       PRIMARY KEY	    (registrant_id)
);

DROP TABLE IF EXISTS asn;

CREATE TABLE asn (
       asn_id               SERIAL NOT NULL,
       start_as             BIGINT unsigned NOT NULL,
       end_as               BIGINT unsigned NOT NULL,
       registrant_id        BIGINT unsigned NOT NULL,
       PRIMARY KEY	    (asn_id),
       FOREIGN KEY          (registrant_id) REFERENCES registrant ON DELETE SET NULL ON UPDATE SET NULL
);

DROP TABLE IF EXISTS net;

CREATE TABLE net (
       net_id               SERIAL NOT NULL,
       start_ip             VARCHAR(40) NOT NULL,
       end_ip               VARCHAR(40) NOT NULL,
       version              TINYINT unsigned NOT NULL,
       registrant_id        BIGINT unsigned NOT NULL,
       PRIMARY KEY          (net_id),
       FOREIGN KEY          (registrant_id) REFERENCES registrant ON DELETE SET NULL ON UPDATE SET NULL
);