File: schema_data.sql

package info (click to toggle)
homer-api 5.0.6%2Bdfsg2-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,604 kB
  • ctags: 2,439
  • sloc: php: 8,259; sql: 1,212; perl: 984; sh: 318; makefile: 69
file content (283 lines) | stat: -rw-r--r-- 13,325 bytes parent folder | download | duplicates (4)
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO homer_user;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public  TO homer_user;

CREATE TABLE IF NOT EXISTS logs_capture (
  id BIGSERIAL NOT NULL,
  date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  micro_ts bigint NOT NULL DEFAULT '0',
  correlation_id varchar(256) NOT NULL DEFAULT '',
  source_ip varchar(60) NOT NULL DEFAULT '',
  source_port integer NOT NULL DEFAULT 0,
  destination_ip varchar(60) NOT NULL DEFAULT '',
  destination_port integer NOT NULL DEFAULT 0,
  proto integer NOT NULL DEFAULT 0,
  family smallint DEFAULT NULL,
  type integer NOT NULL DEFAULT 0,
  node varchar(125) NOT NULL DEFAULT '',
  msg varchar(1500) NOT NULL DEFAULT '',
  PRIMARY KEY (id,date)
);

CREATE INDEX logs_capture_date ON "logs_capture" (date);
CREATE INDEX logs_capture_correlation ON "logs_capture" (correlation_id);
CREATE TABLE logs_capture_p2013082901() INHERITS (logs_capture);
ALTER TABLE logs_capture_p2013082901 ADD CONSTRAINT chk_logs_capture_p2013082901 CHECK (date < to_timestamp(1377734400));

CREATE TABLE IF NOT EXISTS report_capture (
  id BIGSERIAL NOT NULL,
  date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  micro_ts bigint NOT NULL DEFAULT '0',
  correlation_id varchar(256) NOT NULL DEFAULT '',
  source_ip varchar(60) NOT NULL DEFAULT '',
  source_port integer NOT NULL DEFAULT 0,
  destination_ip varchar(60) NOT NULL DEFAULT '',
  destination_port integer NOT NULL DEFAULT 0,
  proto integer NOT NULL DEFAULT 0,
  family smallint DEFAULT NULL,
  type integer NOT NULL DEFAULT 0,
  node varchar(125) NOT NULL DEFAULT '',
  msg varchar(1500) NOT NULL DEFAULT '',
  PRIMARY KEY (id,date)
);

CREATE INDEX report_capture_date ON "report_capture" (date);
CREATE INDEX report_capture_correlation ON "report_capture" (correlation_id);
CREATE TABLE report_capture_p2013082901() INHERITS (report_capture);
ALTER TABLE report_capture_p2013082901 ADD CONSTRAINT chk_report_capture_p2013082901 CHECK (date < to_timestamp(1377734400)); 


CREATE TABLE IF NOT EXISTS webrtc_capture (
  id BIGSERIAL NOT NULL,
  date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  micro_ts bigint NOT NULL DEFAULT '0',
  correlation_id varchar(256) NOT NULL DEFAULT '',
  source_ip varchar(60) NOT NULL DEFAULT '',
  source_port integer NOT NULL DEFAULT 0,
  destination_ip varchar(60) NOT NULL DEFAULT '',
  destination_port integer NOT NULL DEFAULT 0,
  proto integer NOT NULL DEFAULT 0,
  family smallint DEFAULT NULL,
  type integer NOT NULL DEFAULT 0,
  node varchar(125) NOT NULL DEFAULT '',
  msg varchar(1500) NOT NULL DEFAULT '',
  PRIMARY KEY (id,date)
);

CREATE INDEX webrtc_capture_date ON "webrtc_capture" (date);
CREATE INDEX webrtc_capture_correlation ON "webrtc_capture" (correlation_id);
CREATE TABLE webrtc_capture_p2013082901() INHERITS (webrtc_capture);
ALTER TABLE webrtc_capture_p2013082901 ADD CONSTRAINT chk_webrtc_capture_p2013082901 CHECK (date < to_timestamp(1377734400)); 


CREATE TABLE IF NOT EXISTS rtcp_capture (
  id BIGSERIAL NOT NULL,
  date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  micro_ts bigint NOT NULL DEFAULT '0',
  correlation_id varchar(256) NOT NULL DEFAULT '',
  source_ip varchar(60) NOT NULL DEFAULT '',
  source_port integer NOT NULL DEFAULT 0,
  destination_ip varchar(60) NOT NULL DEFAULT '',
  destination_port integer NOT NULL DEFAULT 0,
  proto integer NOT NULL DEFAULT 0,
  family smallint DEFAULT NULL,
  type integer NOT NULL DEFAULT 0,
  node varchar(125) NOT NULL DEFAULT '',
  msg varchar(1500) NOT NULL DEFAULT '',
  PRIMARY KEY (id,date)
);

CREATE INDEX rtcp_capture_date ON "rtcp_capture" (date);
CREATE INDEX rtcp_capture_correlation ON "rtcp_capture" (correlation_id);
CREATE TABLE rtcp_capture_p2013082901() INHERITS (rtcp_capture);
ALTER TABLE rtcp_capture_p2013082901 ADD CONSTRAINT chk_rtcp_capture_p2013082901 CHECK (date < to_timestamp(1377734400)); 


CREATE TABLE IF NOT EXISTS sip_capture_call_20150407 (
  id BIGSERIAL NOT NULL,
  date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  micro_ts bigint NOT NULL DEFAULT '0',
  method varchar(50) NOT NULL DEFAULT '',
  reply_reason varchar(100) NOT NULL DEFAULT '',
  ruri varchar(200) NOT NULL DEFAULT '',
  ruri_user varchar(100) NOT NULL DEFAULT '',
  ruri_domain varchar(150) NOT NULL DEFAULT '',
  from_user varchar(100) NOT NULL DEFAULT '',
  from_domain varchar(150) NOT NULL DEFAULT '',
  from_tag varchar(64) NOT NULL DEFAULT '',
  to_user varchar(100) NOT NULL DEFAULT '',
  to_domain varchar(150) NOT NULL DEFAULT '',
  to_tag varchar(64) NOT NULL DEFAULT '',
  pid_user varchar(100) NOT NULL DEFAULT '',
  contact_user varchar(120) NOT NULL DEFAULT '',
  auth_user varchar(120) NOT NULL DEFAULT '',
  callid varchar(120) NOT NULL DEFAULT '',
  callid_aleg varchar(120) NOT NULL DEFAULT '',
  via_1 varchar(256) NOT NULL DEFAULT '',
  via_1_branch varchar(80) NOT NULL DEFAULT '',
  cseq varchar(25) NOT NULL DEFAULT '',
  diversion varchar(256) NOT NULL DEFAULT '',
  reason varchar(200) NOT NULL DEFAULT '',
  content_type varchar(256) NOT NULL DEFAULT '',
  auth varchar(256) NOT NULL DEFAULT '',
  user_agent varchar(256) NOT NULL DEFAULT '',
  source_ip varchar(60) NOT NULL DEFAULT '',
  source_port integer NOT NULL DEFAULT 0,
  destination_ip varchar(60) NOT NULL DEFAULT '',
  destination_port integer NOT NULL DEFAULT 0,
  contact_ip varchar(60) NOT NULL DEFAULT '',
  contact_port integer NOT NULL DEFAULT 0,
  originator_ip varchar(60) NOT NULL DEFAULT '',
  originator_port integer NOT NULL DEFAULT 0,
  correlation_id varchar(256) NOT NULL DEFAULT '',
  custom_field1 varchar(120) NOT NULL DEFAULT '',
  custom_field2 varchar(120) NOT NULL DEFAULT '',
  custom_field3 varchar(120) NOT NULL DEFAULT '',
  proto integer NOT NULL DEFAULT 0,
  family smallint DEFAULT NULL,
  rtp_stat varchar(256) NOT NULL DEFAULT '',
  type integer NOT NULL DEFAULT 0,
  node varchar(125) NOT NULL DEFAULT '',
  msg bytea NOT NULL DEFAULT '',
  PRIMARY KEY (id,date)
);

CREATE INDEX sip_capture_call_20150407_ruri_user ON "sip_capture_call_20150407" (ruri_user);
CREATE INDEX sip_capture_call_20150407_from_user ON "sip_capture_call_20150407" (from_user);
CREATE INDEX sip_capture_call_20150407_to_user ON "sip_capture_call_20150407" (to_user);
CREATE INDEX sip_capture_call_20150407_pid_user ON "sip_capture_call_20150407" (pid_user);
CREATE INDEX sip_capture_call_20150407_auth_user ON "sip_capture_call_20150407" (auth_user);
CREATE INDEX sip_capture_call_20150407_callid_aleg ON "sip_capture_call_20150407" (callid_aleg);
CREATE INDEX sip_capture_call_20150407_date ON "sip_capture_call_20150407" (date);
CREATE INDEX sip_capture_call_20150407_callid ON "sip_capture_call_20150407" (callid);

CREATE TABLE sip_capture_call_20150407_p2013082901() INHERITS (sip_capture_call_20150407);
ALTER TABLE sip_capture_call_20150407_p2013082901 ADD CONSTRAINT chk_sip_capture_call_20150407_p2013082901 CHECK (date < to_timestamp(1377734400)); 

CREATE TABLE IF NOT EXISTS sip_capture_registration_20150407 (
  id BIGSERIAL NOT NULL,
  date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  micro_ts bigint NOT NULL DEFAULT '0',
  method varchar(50) NOT NULL DEFAULT '',
  reply_reason varchar(100) NOT NULL DEFAULT '',
  ruri varchar(200) NOT NULL DEFAULT '',
  ruri_user varchar(100) NOT NULL DEFAULT '',
  ruri_domain varchar(150) NOT NULL DEFAULT '',
  from_user varchar(100) NOT NULL DEFAULT '',
  from_domain varchar(150) NOT NULL DEFAULT '',
  from_tag varchar(64) NOT NULL DEFAULT '',
  to_user varchar(100) NOT NULL DEFAULT '',
  to_domain varchar(150) NOT NULL DEFAULT '',
  to_tag varchar(64) NOT NULL DEFAULT '',
  pid_user varchar(100) NOT NULL DEFAULT '',
  contact_user varchar(120) NOT NULL DEFAULT '',
  auth_user varchar(120) NOT NULL DEFAULT '',
  callid varchar(120) NOT NULL DEFAULT '',
  callid_aleg varchar(120) NOT NULL DEFAULT '',
  via_1 varchar(256) NOT NULL DEFAULT '',
  via_1_branch varchar(80) NOT NULL DEFAULT '',
  cseq varchar(25) NOT NULL DEFAULT '',
  diversion varchar(256) NOT NULL DEFAULT '',
  reason varchar(200) NOT NULL DEFAULT '',
  content_type varchar(256) NOT NULL DEFAULT '',
  auth varchar(256) NOT NULL DEFAULT '',
  user_agent varchar(256) NOT NULL DEFAULT '',
  source_ip varchar(60) NOT NULL DEFAULT '',
  source_port integer NOT NULL DEFAULT 0,
  destination_ip varchar(60) NOT NULL DEFAULT '',
  destination_port integer NOT NULL DEFAULT 0,
  contact_ip varchar(60) NOT NULL DEFAULT '',
  contact_port integer NOT NULL DEFAULT 0,
  originator_ip varchar(60) NOT NULL DEFAULT '',
  originator_port integer NOT NULL DEFAULT 0,
  correlation_id varchar(256) NOT NULL DEFAULT '',
  custom_field1 varchar(120) NOT NULL DEFAULT '',
  custom_field2 varchar(120) NOT NULL DEFAULT '',
  custom_field3 varchar(120) NOT NULL DEFAULT '',
  proto integer NOT NULL DEFAULT 0,
  family smallint DEFAULT NULL,
  rtp_stat varchar(256) NOT NULL DEFAULT '',
  type integer NOT NULL DEFAULT 0,
  node varchar(125) NOT NULL DEFAULT '',
  msg varchar(1500) NOT NULL DEFAULT '',
  PRIMARY KEY (id,date)
);

CREATE INDEX sip_capture_registration_20150407_ruri_user ON "sip_capture_registration_20150407" (ruri_user);
CREATE INDEX sip_capture_registration_20150407_from_user ON "sip_capture_registration_20150407" (from_user);
CREATE INDEX sip_capture_registration_20150407_to_user ON "sip_capture_registration_20150407" (to_user);
CREATE INDEX sip_capture_registration_20150407_pid_user ON "sip_capture_registration_20150407" (pid_user);
CREATE INDEX sip_capture_registration_20150407_auth_user ON "sip_capture_registration_20150407" (auth_user);
CREATE INDEX sip_capture_registration_20150407_callid_aleg ON "sip_capture_registration_20150407" (callid_aleg);
CREATE INDEX sip_capture_registration_20150407_date ON "sip_capture_registration_20150407" (date);
CREATE INDEX sip_capture_registration_20150407_callid ON "sip_capture_registration_20150407" (callid);

CREATE TABLE sip_capture_registration_20150407_p2013082901() INHERITS (sip_capture_registration_20150407);
ALTER TABLE sip_capture_registration_20150407_p2013082901 ADD CONSTRAINT chk_sip_capture_registration_20150407_p2013082901 CHECK (date < to_timestamp(1377734400)); 


-- --------------------------------------------------------

--
-- Table structure for table sip_capture_rest_20150407
--

CREATE TABLE IF NOT EXISTS sip_capture_rest_20150407 (
  id BIGSERIAL NOT NULL,
  date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  micro_ts bigint NOT NULL DEFAULT '0',
  method varchar(50) NOT NULL DEFAULT '',
  reply_reason varchar(100) NOT NULL DEFAULT '',
  ruri varchar(200) NOT NULL DEFAULT '',
  ruri_user varchar(100) NOT NULL DEFAULT '',
  ruri_domain varchar(150) NOT NULL DEFAULT '',
  from_user varchar(100) NOT NULL DEFAULT '',
  from_domain varchar(150) NOT NULL DEFAULT '',
  from_tag varchar(64) NOT NULL DEFAULT '',
  to_user varchar(100) NOT NULL DEFAULT '',
  to_domain varchar(150) NOT NULL DEFAULT '',
  to_tag varchar(64) NOT NULL DEFAULT '',
  pid_user varchar(100) NOT NULL DEFAULT '',
  contact_user varchar(120) NOT NULL DEFAULT '',
  auth_user varchar(120) NOT NULL DEFAULT '',
  callid varchar(120) NOT NULL DEFAULT '',
  callid_aleg varchar(120) NOT NULL DEFAULT '',
  via_1 varchar(256) NOT NULL DEFAULT '',
  via_1_branch varchar(80) NOT NULL DEFAULT '',
  cseq varchar(25) NOT NULL DEFAULT '',
  diversion varchar(256) NOT NULL DEFAULT '',
  reason varchar(200) NOT NULL DEFAULT '',
  content_type varchar(256) NOT NULL DEFAULT '',
  auth varchar(256) NOT NULL DEFAULT '',
  user_agent varchar(256) NOT NULL DEFAULT '',
  source_ip varchar(60) NOT NULL DEFAULT '',
  source_port integer NOT NULL DEFAULT 0,
  destination_ip varchar(60) NOT NULL DEFAULT '',
  destination_port integer NOT NULL DEFAULT 0,
  contact_ip varchar(60) NOT NULL DEFAULT '',
  contact_port integer NOT NULL DEFAULT 0,
  originator_ip varchar(60) NOT NULL DEFAULT '',
  originator_port integer NOT NULL DEFAULT 0,
  correlation_id varchar(256) NOT NULL DEFAULT '',
  custom_field1 varchar(120) NOT NULL DEFAULT '',
  custom_field2 varchar(120) NOT NULL DEFAULT '',
  custom_field3 varchar(120) NOT NULL DEFAULT '',
  proto integer NOT NULL DEFAULT 0,
  family smallint DEFAULT NULL,
  rtp_stat varchar(256) NOT NULL DEFAULT '',
  type integer NOT NULL DEFAULT 0,
  node varchar(125) NOT NULL DEFAULT '',
  msg varchar(1500) NOT NULL DEFAULT '',
  PRIMARY KEY (id,date)
);

CREATE INDEX sip_capture_rest_20150407_ruri_user ON "sip_capture_rest_20150407" (ruri_user);
CREATE INDEX sip_capture_rest_20150407_from_user ON "sip_capture_rest_20150407" (from_user);
CREATE INDEX sip_capture_rest_20150407_to_user ON "sip_capture_rest_20150407" (to_user);
CREATE INDEX sip_capture_rest_20150407_pid_user ON "sip_capture_rest_20150407" (pid_user);
CREATE INDEX sip_capture_rest_20150407_auth_user ON "sip_capture_rest_20150407" (auth_user);
CREATE INDEX sip_capture_rest_20150407_callid_aleg ON "sip_capture_rest_20150407" (callid_aleg);
CREATE INDEX sip_capture_rest_20150407_date ON "sip_capture_rest_20150407" (date);
CREATE INDEX sip_capture_rest_20150407_callid ON "sip_capture_rest_20150407" (callid);

CREATE TABLE sip_capture_rest_20150407_p2013082901() INHERITS (sip_capture_rest_20150407);
ALTER TABLE sip_capture_rest_20150407_p2013082901 ADD CONSTRAINT chk_sip_capture_rest_20150407_p2013082901 CHECK (date < to_timestamp(1377734400));