blob: e01ce3b0d8b4d22acd807dfcea8e0af077a01e10 [file] [log] [blame]
Fiachra Corcorane06737d2018-08-09 00:04:29 +01001use datarouter;
2
3CREATE TABLE FEEDS (
4 FEEDID INT UNSIGNED NOT NULL PRIMARY KEY,
5 GROUPID INT(10) UNSIGNED NOT NULL DEFAULT 0,
6 NAME VARCHAR(255) NOT NULL,
7 VERSION VARCHAR(20) NOT NULL,
8 DESCRIPTION VARCHAR(1000),
9 BUSINESS_DESCRIPTION VARCHAR(1000) DEFAULT NULL,
10 AUTH_CLASS VARCHAR(32) NOT NULL,
11 PUBLISHER VARCHAR(8) NOT NULL,
12 SELF_LINK VARCHAR(256),
13 PUBLISH_LINK VARCHAR(256),
14 SUBSCRIBE_LINK VARCHAR(256),
15 LOG_LINK VARCHAR(256),
16 DELETED BOOLEAN DEFAULT FALSE,
17 LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
18 SUSPENDED BOOLEAN DEFAULT FALSE,
19 CREATED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP
20);
21
22CREATE TABLE FEED_ENDPOINT_IDS (
23 FEEDID INT UNSIGNED NOT NULL,
24 USERID VARCHAR(20) NOT NULL,
25 PASSWORD VARCHAR(32) NOT NULL
26);
27
28CREATE TABLE FEED_ENDPOINT_ADDRS (
29 FEEDID INT UNSIGNED NOT NULL,
30 ADDR VARCHAR(44) NOT NULL
31);
32
33CREATE TABLE SUBSCRIPTIONS (
34 SUBID INT UNSIGNED NOT NULL PRIMARY KEY,
35 FEEDID INT UNSIGNED NOT NULL,
36 GROUPID INT(10) UNSIGNED NOT NULL DEFAULT 0,
37 DELIVERY_URL VARCHAR(256),
38 DELIVERY_USER VARCHAR(20),
39 DELIVERY_PASSWORD VARCHAR(32),
40 DELIVERY_USE100 BOOLEAN DEFAULT FALSE,
41 METADATA_ONLY BOOLEAN DEFAULT FALSE,
42 SUBSCRIBER VARCHAR(8) NOT NULL,
43 SELF_LINK VARCHAR(256),
44 LOG_LINK VARCHAR(256),
45 LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
46 SUSPENDED BOOLEAN DEFAULT FALSE,
47 CREATED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP
48
49);
50
51CREATE TABLE PARAMETERS (
52 KEYNAME VARCHAR(32) NOT NULL PRIMARY KEY,
53 VALUE VARCHAR(4096) NOT NULL
54);
55
56CREATE TABLE LOG_RECORDS (
57 TYPE ENUM('pub', 'del', 'exp', 'pbf', 'dlx') NOT NULL,
58 EVENT_TIME BIGINT NOT NULL, /* time of the publish request */
59 PUBLISH_ID VARCHAR(64) NOT NULL, /* unique ID assigned to this publish attempt */
60 FEEDID INT UNSIGNED NOT NULL, /* pointer to feed in FEEDS */
61 REQURI VARCHAR(256) NOT NULL, /* request URI */
62 METHOD ENUM('DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'POST', 'TRACE') NOT NULL, /* HTTP method */
63 CONTENT_TYPE VARCHAR(256) NOT NULL, /* content type of published file */
64 CONTENT_LENGTH BIGINT NOT NULL, /* content length of published file */
65
66 FEED_FILEID VARCHAR(256), /* file ID of published file */
67 REMOTE_ADDR VARCHAR(40), /* IP address of publishing endpoint */
68 USER VARCHAR(50), /* user name of publishing endpoint */
69 STATUS SMALLINT, /* status code returned to delivering agent */
70
71 DELIVERY_SUBID INT UNSIGNED, /* pointer to subscription in SUBSCRIPTIONS */
72 DELIVERY_FILEID VARCHAR(256), /* file ID of file being delivered */
73 RESULT SMALLINT, /* result received from subscribing agent */
74
75 ATTEMPTS INT, /* deliveries attempted */
76 REASON ENUM('notRetryable', 'retriesExhausted', 'diskFull', 'other'),
77
78 RECORD_ID BIGINT UNSIGNED NOT NULL PRIMARY KEY, /* unique ID for this record */
79 CONTENT_LENGTH_2 BIGINT,
80
81 INDEX (FEEDID) USING BTREE,
82 INDEX (DELIVERY_SUBID) USING BTREE,
83 INDEX (RECORD_ID) USING BTREE
84) ENGINE = MyISAM;
85
86CREATE TABLE INGRESS_ROUTES (
87 SEQUENCE INT UNSIGNED NOT NULL,
88 FEEDID INT UNSIGNED NOT NULL,
89 USERID VARCHAR(20),
90 SUBNET VARCHAR(44),
91 NODESET INT UNSIGNED NOT NULL
92);
93
94CREATE TABLE EGRESS_ROUTES (
95 SUBID INT UNSIGNED NOT NULL PRIMARY KEY,
96 NODEID INT UNSIGNED NOT NULL
97);
98
99CREATE TABLE NETWORK_ROUTES (
100 FROMNODE INT UNSIGNED NOT NULL,
101 TONODE INT UNSIGNED NOT NULL,
102 VIANODE INT UNSIGNED NOT NULL
103);
104
105CREATE TABLE NODESETS (
106 SETID INT UNSIGNED NOT NULL,
107 NODEID INT UNSIGNED NOT NULL
108);
109
110CREATE TABLE NODES (
111 NODEID INT UNSIGNED NOT NULL PRIMARY KEY,
112 NAME VARCHAR(255) NOT NULL,
113 ACTIVE BOOLEAN DEFAULT TRUE
114);
115
116CREATE TABLE GROUPS (
117 GROUPID INT UNSIGNED NOT NULL PRIMARY KEY,
118 AUTHID VARCHAR(100) NOT NULL,
119 NAME VARCHAR(50) NOT NULL,
120 DESCRIPTION VARCHAR(255),
121 CLASSIFICATION VARCHAR(20) NOT NULL,
122 MEMBERS TINYTEXT,
123 LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP
124);
125
126INSERT INTO PARAMETERS VALUES
127 ('ACTIVE_POD', 'prov.datarouternew.com'),
128 ('PROV_ACTIVE_NAME', 'prov.datarouternew.com'),
129 ('STANDBY_POD', ''),
130 ('PROV_NAME', 'prov.datarouternew.com'),
131 ('NODES', '172.100.0.1|node.datarouternew.com'),
132 ('PROV_DOMAIN', 'datarouternew.com'),
133 ('DELIVERY_INIT_RETRY_INTERVAL', '10'),
134 ('DELIVERY_MAX_AGE', '86400'),
135 ('DELIVERY_MAX_RETRY_INTERVAL', '3600'),
136 ('DELIVERY_RETRY_RATIO', '2'),
137 ('LOGROLL_INTERVAL', '300'),
138 ('PROV_AUTH_ADDRESSES', '172.100.0.1|prov.datarouternew.com|node.datarouternew.com'),
139 ('PROV_AUTH_SUBJECTS', ''),
140 ('PROV_MAXFEED_COUNT', '10000'),
141 ('PROV_MAXSUB_COUNT', '100000'),
142 ('PROV_REQUIRE_CERT', 'false'),
143 ('PROV_REQUIRE_SECURE', 'false'),
144 ('_INT_VALUES', 'LOGROLL_INTERVAL|PROV_MAXFEED_COUNT|PROV_MAXSUB_COUNT|DELIVERY_INIT_RETRY_INTERVAL|DELIVERY_MAX_RETRY_INTERVAL|DELIVERY_RETRY_RATIO|DELIVERY_MAX_AGE')
145 ;