1 /*
2 ** Zabbix
3 ** Copyright (C) 2001-2021 Zabbix SIA
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 **/
19 
20 #include "common.h"
21 #include "dbschema.h"
22 
23 const ZBX_TABLE	tables[] = {
24 
25 #if defined(HAVE_IBM_DB2) || defined(HAVE_ORACLE)
26 #	define ZBX_TYPE_SHORTTEXT_LEN	2048
27 #else
28 #	define ZBX_TYPE_SHORTTEXT_LEN	65535
29 #endif
30 
31 #if defined(HAVE_IBM_DB2)
32 #	define ZBX_TYPE_LONGTEXT_LEN	2048
33 #	define ZBX_TYPE_TEXT_LEN	2048
34 #else
35 #	define ZBX_TYPE_LONGTEXT_LEN	0
36 #	define ZBX_TYPE_TEXT_LEN	65535
37 #endif
38 
39 	{"users",	"userid",	0,
40 		{
41 		{"userid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
42 		{"alias",	"",	NULL,	NULL,	100,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
43 		{"name",	"",	NULL,	NULL,	100,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
44 		{"surname",	"",	NULL,	NULL,	100,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
45 		{"passwd",	"",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
46 		{"url",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
47 		{"autologin",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
48 		{"autologout",	"15m",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
49 		{"lang",	"en_GB",	NULL,	NULL,	5,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
50 		{"refresh",	"30s",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
51 		{"type",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
52 		{"theme",	"default",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
53 		{"attempt_failed",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
54 		{"attempt_ip",	"",	NULL,	NULL,	39,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
55 		{"attempt_clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
56 		{"rows_per_page",	"50",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
57 		{0}
58 		},
59 		"alias"
60 	},
61 	{"maintenances",	"maintenanceid",	0,
62 		{
63 		{"maintenanceid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
64 		{"name",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
65 		{"maintenance_type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
66 		{"description",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
67 		{"active_since",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
68 		{"active_till",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
69 		{"tags_evaltype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
70 		{0}
71 		},
72 		"name"
73 	},
74 	{"hosts",	"hostid",	0,
75 		{
76 		{"hostid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
77 		{"proxy_hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	0,	0},
78 		{"host",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
79 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
80 		{"disable_until",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
81 		{"error",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
82 		{"available",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
83 		{"errors_from",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
84 		{"lastaccess",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
85 		{"ipmi_authtype",	"-1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
86 		{"ipmi_privilege",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
87 		{"ipmi_username",	"",	NULL,	NULL,	16,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
88 		{"ipmi_password",	"",	NULL,	NULL,	20,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
89 		{"ipmi_disable_until",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
90 		{"ipmi_available",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
91 		{"snmp_disable_until",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
92 		{"snmp_available",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
93 		{"maintenanceid",	NULL,	"maintenances",	"maintenanceid",	0,	ZBX_TYPE_ID,	0,	0},
94 		{"maintenance_status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
95 		{"maintenance_type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
96 		{"maintenance_from",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
97 		{"ipmi_errors_from",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
98 		{"snmp_errors_from",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
99 		{"ipmi_error",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
100 		{"snmp_error",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
101 		{"jmx_disable_until",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
102 		{"jmx_available",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
103 		{"jmx_errors_from",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
104 		{"jmx_error",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
105 		{"name",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
106 		{"flags",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
107 		{"templateid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
108 		{"description",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
109 		{"tls_connect",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
110 		{"tls_accept",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
111 		{"tls_issuer",	"",	NULL,	NULL,	1024,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
112 		{"tls_subject",	"",	NULL,	NULL,	1024,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
113 		{"tls_psk_identity",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
114 		{"tls_psk",	"",	NULL,	NULL,	512,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
115 		{"proxy_address",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
116 		{"auto_compress",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
117 		{0}
118 		},
119 		NULL
120 	},
121 	{"hstgrp",	"groupid",	0,
122 		{
123 		{"groupid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
124 		{"name",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
125 		{"internal",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
126 		{"flags",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
127 		{0}
128 		},
129 		NULL
130 	},
131 	{"group_prototype",	"group_prototypeid",	0,
132 		{
133 		{"group_prototypeid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
134 		{"hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
135 		{"name",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
136 		{"groupid",	NULL,	"hstgrp",	"groupid",	0,	ZBX_TYPE_ID,	0,	0},
137 		{"templateid",	NULL,	"group_prototype",	"group_prototypeid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
138 		{0}
139 		},
140 		NULL
141 	},
142 	{"group_discovery",	"groupid",	0,
143 		{
144 		{"groupid",	NULL,	"hstgrp",	"groupid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
145 		{"parent_group_prototypeid",	NULL,	"group_prototype",	"group_prototypeid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
146 		{"name",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
147 		{"lastcheck",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
148 		{"ts_delete",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
149 		{0}
150 		},
151 		NULL
152 	},
153 	{"screens",	"screenid",	0,
154 		{
155 		{"screenid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
156 		{"name",	NULL,	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
157 		{"hsize",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
158 		{"vsize",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
159 		{"templateid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
160 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	0,	0},
161 		{"private",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
162 		{0}
163 		},
164 		NULL
165 	},
166 	{"screens_items",	"screenitemid",	0,
167 		{
168 		{"screenitemid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
169 		{"screenid",	NULL,	"screens",	"screenid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
170 		{"resourcetype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
171 		{"resourceid",	"0",	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
172 		{"width",	"320",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
173 		{"height",	"200",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
174 		{"x",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
175 		{"y",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
176 		{"colspan",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
177 		{"rowspan",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
178 		{"elements",	"25",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
179 		{"valign",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
180 		{"halign",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
181 		{"style",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
182 		{"url",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
183 		{"dynamic",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
184 		{"sort_triggers",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
185 		{"application",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
186 		{"max_columns",	"3",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
187 		{0}
188 		},
189 		NULL
190 	},
191 	{"screen_user",	"screenuserid",	0,
192 		{
193 		{"screenuserid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
194 		{"screenid",	NULL,	"screens",	"screenid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
195 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
196 		{"permission",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
197 		{0}
198 		},
199 		"screenid,userid"
200 	},
201 	{"screen_usrgrp",	"screenusrgrpid",	0,
202 		{
203 		{"screenusrgrpid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
204 		{"screenid",	NULL,	"screens",	"screenid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
205 		{"usrgrpid",	NULL,	"usrgrp",	"usrgrpid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
206 		{"permission",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
207 		{0}
208 		},
209 		"screenid,usrgrpid"
210 	},
211 	{"slideshows",	"slideshowid",	0,
212 		{
213 		{"slideshowid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
214 		{"name",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
215 		{"delay",	"30s",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
216 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
217 		{"private",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
218 		{0}
219 		},
220 		"name"
221 	},
222 	{"slideshow_user",	"slideshowuserid",	0,
223 		{
224 		{"slideshowuserid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
225 		{"slideshowid",	NULL,	"slideshows",	"slideshowid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
226 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
227 		{"permission",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
228 		{0}
229 		},
230 		"slideshowid,userid"
231 	},
232 	{"slideshow_usrgrp",	"slideshowusrgrpid",	0,
233 		{
234 		{"slideshowusrgrpid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
235 		{"slideshowid",	NULL,	"slideshows",	"slideshowid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
236 		{"usrgrpid",	NULL,	"usrgrp",	"usrgrpid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
237 		{"permission",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
238 		{0}
239 		},
240 		"slideshowid,usrgrpid"
241 	},
242 	{"slides",	"slideid",	0,
243 		{
244 		{"slideid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
245 		{"slideshowid",	NULL,	"slideshows",	"slideshowid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
246 		{"screenid",	NULL,	"screens",	"screenid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
247 		{"step",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
248 		{"delay",	"0",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
249 		{0}
250 		},
251 		NULL
252 	},
253 	{"drules",	"druleid",	0,
254 		{
255 		{"druleid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
256 		{"proxy_hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	0,	0},
257 		{"name",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
258 		{"iprange",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
259 		{"delay",	"1h",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
260 		{"nextcheck",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
261 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
262 		{0}
263 		},
264 		"name"
265 	},
266 	{"dchecks",	"dcheckid",	0,
267 		{
268 		{"dcheckid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
269 		{"druleid",	NULL,	"drules",	"druleid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | ZBX_PROXY,	ZBX_FK_CASCADE_DELETE},
270 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
271 		{"key_",	"",	NULL,	NULL,	512,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
272 		{"snmp_community",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
273 		{"ports",	"0",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
274 		{"snmpv3_securityname",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
275 		{"snmpv3_securitylevel",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
276 		{"snmpv3_authpassphrase",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
277 		{"snmpv3_privpassphrase",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
278 		{"uniq",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
279 		{"snmpv3_authprotocol",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
280 		{"snmpv3_privprotocol",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
281 		{"snmpv3_contextname",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
282 		{0}
283 		},
284 		NULL
285 	},
286 	{"applications",	"applicationid",	0,
287 		{
288 		{"applicationid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
289 		{"hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
290 		{"name",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
291 		{"flags",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
292 		{0}
293 		},
294 		"hostid,name"
295 	},
296 	{"httptest",	"httptestid",	0,
297 		{
298 		{"httptestid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
299 		{"name",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
300 		{"applicationid",	NULL,	"applications",	"applicationid",	0,	ZBX_TYPE_ID,	0,	0},
301 		{"nextcheck",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
302 		{"delay",	"1m",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
303 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
304 		{"agent",	"Zabbix",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
305 		{"authentication",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
306 		{"http_user",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
307 		{"http_password",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
308 		{"hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | ZBX_PROXY,	ZBX_FK_CASCADE_DELETE},
309 		{"templateid",	NULL,	"httptest",	"httptestid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
310 		{"http_proxy",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
311 		{"retries",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
312 		{"ssl_cert_file",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
313 		{"ssl_key_file",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
314 		{"ssl_key_password",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
315 		{"verify_peer",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
316 		{"verify_host",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
317 		{0}
318 		},
319 		"hostid,name"
320 	},
321 	{"httpstep",	"httpstepid",	0,
322 		{
323 		{"httpstepid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
324 		{"httptestid",	NULL,	"httptest",	"httptestid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | ZBX_PROXY,	ZBX_FK_CASCADE_DELETE},
325 		{"name",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
326 		{"no",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
327 		{"url",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
328 		{"timeout",	"15s",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
329 		{"posts",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL | ZBX_PROXY,	0},
330 		{"required",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
331 		{"status_codes",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
332 		{"follow_redirects",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
333 		{"retrieve_mode",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
334 		{"post_type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
335 		{0}
336 		},
337 		NULL
338 	},
339 	{"interface",	"interfaceid",	0,
340 		{
341 		{"interfaceid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
342 		{"hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | ZBX_PROXY,	ZBX_FK_CASCADE_DELETE},
343 		{"main",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
344 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
345 		{"useip",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
346 		{"ip",	"127.0.0.1",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
347 		{"dns",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
348 		{"port",	"10050",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
349 		{"bulk",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
350 		{0}
351 		},
352 		NULL
353 	},
354 	{"valuemaps",	"valuemapid",	0,
355 		{
356 		{"valuemapid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
357 		{"name",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
358 		{0}
359 		},
360 		"name"
361 	},
362 	{"items",	"itemid",	0,
363 		{
364 		{"itemid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
365 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
366 		{"snmp_community",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
367 		{"snmp_oid",	"",	NULL,	NULL,	512,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
368 		{"hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | ZBX_PROXY,	ZBX_FK_CASCADE_DELETE},
369 		{"name",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
370 		{"key_",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
371 		{"delay",	"0",	NULL,	NULL,	1024,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
372 		{"history",	"90d",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
373 		{"trends",	"365d",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
374 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
375 		{"value_type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
376 		{"trapper_hosts",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
377 		{"units",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
378 		{"snmpv3_securityname",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
379 		{"snmpv3_securitylevel",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
380 		{"snmpv3_authpassphrase",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
381 		{"snmpv3_privpassphrase",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
382 		{"formula",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
383 		{"error",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
384 		{"lastlogsize",	"0",	NULL,	NULL,	0,	ZBX_TYPE_UINT,	ZBX_NOTNULL | ZBX_PROXY,	0},
385 		{"logtimefmt",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
386 		{"templateid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
387 		{"valuemapid",	NULL,	"valuemaps",	"valuemapid",	0,	ZBX_TYPE_ID,	0,	0},
388 		{"params",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL | ZBX_PROXY,	0},
389 		{"ipmi_sensor",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
390 		{"authtype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
391 		{"username",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
392 		{"password",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
393 		{"publickey",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
394 		{"privatekey",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
395 		{"mtime",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
396 		{"flags",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
397 		{"interfaceid",	NULL,	"interface",	"interfaceid",	0,	ZBX_TYPE_ID,	ZBX_PROXY,	0},
398 		{"port",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
399 		{"description",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
400 		{"inventory_link",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
401 		{"lifetime",	"30d",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
402 		{"snmpv3_authprotocol",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
403 		{"snmpv3_privprotocol",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
404 		{"state",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
405 		{"snmpv3_contextname",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
406 		{"evaltype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
407 		{"jmx_endpoint",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
408 		{"master_itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
409 		{"timeout",	"3s",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
410 		{"url",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
411 		{"query_fields",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
412 		{"posts",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL | ZBX_PROXY,	0},
413 		{"status_codes",	"200",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
414 		{"follow_redirects",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
415 		{"post_type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
416 		{"http_proxy",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
417 		{"headers",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL | ZBX_PROXY,	0},
418 		{"retrieve_mode",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
419 		{"request_method",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
420 		{"output_format",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
421 		{"ssl_cert_file",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
422 		{"ssl_key_file",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
423 		{"ssl_key_password",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
424 		{"verify_peer",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
425 		{"verify_host",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
426 		{"allow_traps",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
427 		{0}
428 		},
429 		"hostid,key_"
430 	},
431 	{"httpstepitem",	"httpstepitemid",	0,
432 		{
433 		{"httpstepitemid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
434 		{"httpstepid",	NULL,	"httpstep",	"httpstepid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | ZBX_PROXY,	ZBX_FK_CASCADE_DELETE},
435 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | ZBX_PROXY,	ZBX_FK_CASCADE_DELETE},
436 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
437 		{0}
438 		},
439 		"httpstepid,itemid"
440 	},
441 	{"httptestitem",	"httptestitemid",	0,
442 		{
443 		{"httptestitemid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
444 		{"httptestid",	NULL,	"httptest",	"httptestid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | ZBX_PROXY,	ZBX_FK_CASCADE_DELETE},
445 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | ZBX_PROXY,	ZBX_FK_CASCADE_DELETE},
446 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
447 		{0}
448 		},
449 		"httptestid,itemid"
450 	},
451 	{"media_type",	"mediatypeid",	0,
452 		{
453 		{"mediatypeid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
454 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
455 		{"description",	"",	NULL,	NULL,	100,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
456 		{"smtp_server",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
457 		{"smtp_helo",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
458 		{"smtp_email",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
459 		{"exec_path",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
460 		{"gsm_modem",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
461 		{"username",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
462 		{"passwd",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
463 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
464 		{"smtp_port",	"25",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
465 		{"smtp_security",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
466 		{"smtp_verify_peer",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
467 		{"smtp_verify_host",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
468 		{"smtp_authentication",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
469 		{"exec_params",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
470 		{"maxsessions",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
471 		{"maxattempts",	"3",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
472 		{"attempt_interval",	"10s",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
473 		{0}
474 		},
475 		"description"
476 	},
477 	{"usrgrp",	"usrgrpid",	0,
478 		{
479 		{"usrgrpid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
480 		{"name",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
481 		{"gui_access",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
482 		{"users_status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
483 		{"debug_mode",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
484 		{0}
485 		},
486 		"name"
487 	},
488 	{"users_groups",	"id",	0,
489 		{
490 		{"id",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
491 		{"usrgrpid",	NULL,	"usrgrp",	"usrgrpid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
492 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
493 		{0}
494 		},
495 		"usrgrpid,userid"
496 	},
497 	{"scripts",	"scriptid",	0,
498 		{
499 		{"scriptid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
500 		{"name",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
501 		{"command",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
502 		{"host_access",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
503 		{"usrgrpid",	NULL,	"usrgrp",	"usrgrpid",	0,	ZBX_TYPE_ID,	0,	0},
504 		{"groupid",	NULL,	"hstgrp",	"groupid",	0,	ZBX_TYPE_ID,	0,	0},
505 		{"description",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
506 		{"confirmation",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
507 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
508 		{"execute_on",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
509 		{0}
510 		},
511 		"name"
512 	},
513 	{"actions",	"actionid",	0,
514 		{
515 		{"actionid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
516 		{"name",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
517 		{"eventsource",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
518 		{"evaltype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
519 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
520 		{"esc_period",	"1h",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
521 		{"def_shortdata",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
522 		{"def_longdata",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
523 		{"r_shortdata",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
524 		{"r_longdata",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
525 		{"formula",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
526 		{"pause_suppressed",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
527 		{"ack_shortdata",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
528 		{"ack_longdata",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
529 		{0}
530 		},
531 		"name"
532 	},
533 	{"operations",	"operationid",	0,
534 		{
535 		{"operationid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
536 		{"actionid",	NULL,	"actions",	"actionid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
537 		{"operationtype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
538 		{"esc_period",	"0",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
539 		{"esc_step_from",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
540 		{"esc_step_to",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
541 		{"evaltype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
542 		{"recovery",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
543 		{0}
544 		},
545 		NULL
546 	},
547 	{"opmessage",	"operationid",	0,
548 		{
549 		{"operationid",	NULL,	"operations",	"operationid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
550 		{"default_msg",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
551 		{"subject",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
552 		{"message",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
553 		{"mediatypeid",	NULL,	"media_type",	"mediatypeid",	0,	ZBX_TYPE_ID,	0,	0},
554 		{0}
555 		},
556 		NULL
557 	},
558 	{"opmessage_grp",	"opmessage_grpid",	0,
559 		{
560 		{"opmessage_grpid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
561 		{"operationid",	NULL,	"operations",	"operationid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
562 		{"usrgrpid",	NULL,	"usrgrp",	"usrgrpid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
563 		{0}
564 		},
565 		"operationid,usrgrpid"
566 	},
567 	{"opmessage_usr",	"opmessage_usrid",	0,
568 		{
569 		{"opmessage_usrid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
570 		{"operationid",	NULL,	"operations",	"operationid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
571 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
572 		{0}
573 		},
574 		"operationid,userid"
575 	},
576 	{"opcommand",	"operationid",	0,
577 		{
578 		{"operationid",	NULL,	"operations",	"operationid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
579 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
580 		{"scriptid",	NULL,	"scripts",	"scriptid",	0,	ZBX_TYPE_ID,	0,	0},
581 		{"execute_on",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
582 		{"port",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
583 		{"authtype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
584 		{"username",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
585 		{"password",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
586 		{"publickey",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
587 		{"privatekey",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
588 		{"command",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
589 		{0}
590 		},
591 		NULL
592 	},
593 	{"opcommand_hst",	"opcommand_hstid",	0,
594 		{
595 		{"opcommand_hstid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
596 		{"operationid",	NULL,	"operations",	"operationid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
597 		{"hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	0,	0},
598 		{0}
599 		},
600 		NULL
601 	},
602 	{"opcommand_grp",	"opcommand_grpid",	0,
603 		{
604 		{"opcommand_grpid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
605 		{"operationid",	NULL,	"operations",	"operationid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
606 		{"groupid",	NULL,	"hstgrp",	"groupid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
607 		{0}
608 		},
609 		NULL
610 	},
611 	{"opgroup",	"opgroupid",	0,
612 		{
613 		{"opgroupid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
614 		{"operationid",	NULL,	"operations",	"operationid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
615 		{"groupid",	NULL,	"hstgrp",	"groupid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
616 		{0}
617 		},
618 		"operationid,groupid"
619 	},
620 	{"optemplate",	"optemplateid",	0,
621 		{
622 		{"optemplateid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
623 		{"operationid",	NULL,	"operations",	"operationid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
624 		{"templateid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
625 		{0}
626 		},
627 		"operationid,templateid"
628 	},
629 	{"opconditions",	"opconditionid",	0,
630 		{
631 		{"opconditionid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
632 		{"operationid",	NULL,	"operations",	"operationid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
633 		{"conditiontype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
634 		{"operator",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
635 		{"value",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
636 		{0}
637 		},
638 		NULL
639 	},
640 	{"conditions",	"conditionid",	0,
641 		{
642 		{"conditionid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
643 		{"actionid",	NULL,	"actions",	"actionid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
644 		{"conditiontype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
645 		{"operator",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
646 		{"value",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
647 		{"value2",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
648 		{0}
649 		},
650 		NULL
651 	},
652 	{"config",	"configid",	0,
653 		{
654 		{"configid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
655 		{"refresh_unsupported",	"10m",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
656 		{"work_period",	"1-5,09:00-18:00",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
657 		{"alert_usrgrpid",	NULL,	"usrgrp",	"usrgrpid",	0,	ZBX_TYPE_ID,	0,	0},
658 		{"default_theme",	"blue-theme",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
659 		{"authentication_type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
660 		{"ldap_host",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
661 		{"ldap_port",	"389",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
662 		{"ldap_base_dn",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
663 		{"ldap_bind_dn",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
664 		{"ldap_bind_password",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
665 		{"ldap_search_attribute",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
666 		{"dropdown_first_entry",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
667 		{"dropdown_first_remember",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
668 		{"discovery_groupid",	NULL,	"hstgrp",	"groupid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | ZBX_PROXY,	0},
669 		{"max_in_table",	"50",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
670 		{"search_limit",	"1000",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
671 		{"severity_color_0",	"97AAB3",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
672 		{"severity_color_1",	"7499FF",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
673 		{"severity_color_2",	"FFC859",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
674 		{"severity_color_3",	"FFA059",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
675 		{"severity_color_4",	"E97659",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
676 		{"severity_color_5",	"E45959",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
677 		{"severity_name_0",	"Not classified",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
678 		{"severity_name_1",	"Information",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
679 		{"severity_name_2",	"Warning",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
680 		{"severity_name_3",	"Average",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
681 		{"severity_name_4",	"High",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
682 		{"severity_name_5",	"Disaster",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
683 		{"ok_period",	"5m",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
684 		{"blink_period",	"2m",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
685 		{"problem_unack_color",	"CC0000",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
686 		{"problem_ack_color",	"CC0000",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
687 		{"ok_unack_color",	"009900",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
688 		{"ok_ack_color",	"009900",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
689 		{"problem_unack_style",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
690 		{"problem_ack_style",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
691 		{"ok_unack_style",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
692 		{"ok_ack_style",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
693 		{"snmptrap_logging",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
694 		{"server_check_interval",	"10",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
695 		{"hk_events_mode",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
696 		{"hk_events_trigger",	"365d",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
697 		{"hk_events_internal",	"1d",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
698 		{"hk_events_discovery",	"1d",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
699 		{"hk_events_autoreg",	"1d",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
700 		{"hk_services_mode",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
701 		{"hk_services",	"365d",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
702 		{"hk_audit_mode",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
703 		{"hk_audit",	"365d",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
704 		{"hk_sessions_mode",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
705 		{"hk_sessions",	"365d",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
706 		{"hk_history_mode",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
707 		{"hk_history_global",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
708 		{"hk_history",	"90d",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
709 		{"hk_trends_mode",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
710 		{"hk_trends_global",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
711 		{"hk_trends",	"365d",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
712 		{"default_inventory_mode",	"-1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
713 		{"custom_color",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
714 		{"http_auth_enabled",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
715 		{"http_login_form",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
716 		{"http_strip_domains",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
717 		{"http_case_sensitive",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
718 		{"ldap_configured",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
719 		{"ldap_case_sensitive",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
720 		{0}
721 		},
722 		NULL
723 	},
724 	{"triggers",	"triggerid",	0,
725 		{
726 		{"triggerid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
727 		{"expression",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
728 		{"description",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
729 		{"url",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
730 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
731 		{"value",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
732 		{"priority",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
733 		{"lastchange",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
734 		{"comments",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
735 		{"error",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
736 		{"templateid",	NULL,	"triggers",	"triggerid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
737 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
738 		{"state",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
739 		{"flags",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
740 		{"recovery_mode",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
741 		{"recovery_expression",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
742 		{"correlation_mode",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
743 		{"correlation_tag",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
744 		{"manual_close",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
745 		{0}
746 		},
747 		NULL
748 	},
749 	{"trigger_depends",	"triggerdepid",	0,
750 		{
751 		{"triggerdepid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
752 		{"triggerid_down",	NULL,	"triggers",	"triggerid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
753 		{"triggerid_up",	NULL,	"triggers",	"triggerid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
754 		{0}
755 		},
756 		"triggerid_down,triggerid_up"
757 	},
758 	{"functions",	"functionid",	0,
759 		{
760 		{"functionid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
761 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
762 		{"triggerid",	NULL,	"triggers",	"triggerid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
763 		{"name",	"",	NULL,	NULL,	12,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
764 		{"parameter",	"0",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
765 		{0}
766 		},
767 		NULL
768 	},
769 	{"graphs",	"graphid",	0,
770 		{
771 		{"graphid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
772 		{"name",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
773 		{"width",	"900",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
774 		{"height",	"200",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
775 		{"yaxismin",	"0",	NULL,	NULL,	0,	ZBX_TYPE_FLOAT,	ZBX_NOTNULL,	0},
776 		{"yaxismax",	"100",	NULL,	NULL,	0,	ZBX_TYPE_FLOAT,	ZBX_NOTNULL,	0},
777 		{"templateid",	NULL,	"graphs",	"graphid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
778 		{"show_work_period",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
779 		{"show_triggers",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
780 		{"graphtype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
781 		{"show_legend",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
782 		{"show_3d",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
783 		{"percent_left",	"0",	NULL,	NULL,	0,	ZBX_TYPE_FLOAT,	ZBX_NOTNULL,	0},
784 		{"percent_right",	"0",	NULL,	NULL,	0,	ZBX_TYPE_FLOAT,	ZBX_NOTNULL,	0},
785 		{"ymin_type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
786 		{"ymax_type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
787 		{"ymin_itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	0,	0},
788 		{"ymax_itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	0,	0},
789 		{"flags",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
790 		{0}
791 		},
792 		NULL
793 	},
794 	{"graphs_items",	"gitemid",	0,
795 		{
796 		{"gitemid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
797 		{"graphid",	NULL,	"graphs",	"graphid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
798 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
799 		{"drawtype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
800 		{"sortorder",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
801 		{"color",	"009600",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
802 		{"yaxisside",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
803 		{"calc_fnc",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
804 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
805 		{0}
806 		},
807 		NULL
808 	},
809 	{"graph_theme",	"graphthemeid",	0,
810 		{
811 		{"graphthemeid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
812 		{"theme",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
813 		{"backgroundcolor",	"",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
814 		{"graphcolor",	"",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
815 		{"gridcolor",	"",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
816 		{"maingridcolor",	"",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
817 		{"gridbordercolor",	"",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
818 		{"textcolor",	"",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
819 		{"highlightcolor",	"",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
820 		{"leftpercentilecolor",	"",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
821 		{"rightpercentilecolor",	"",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
822 		{"nonworktimecolor",	"",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
823 		{"colorpalette",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
824 		{0}
825 		},
826 		"theme"
827 	},
828 	{"globalmacro",	"globalmacroid",	0,
829 		{
830 		{"globalmacroid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
831 		{"macro",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
832 		{"value",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
833 		{0}
834 		},
835 		"macro"
836 	},
837 	{"hostmacro",	"hostmacroid",	0,
838 		{
839 		{"hostmacroid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
840 		{"hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | ZBX_PROXY,	ZBX_FK_CASCADE_DELETE},
841 		{"macro",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
842 		{"value",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
843 		{0}
844 		},
845 		"hostid,macro"
846 	},
847 	{"hosts_groups",	"hostgroupid",	0,
848 		{
849 		{"hostgroupid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
850 		{"hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
851 		{"groupid",	NULL,	"hstgrp",	"groupid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
852 		{0}
853 		},
854 		"hostid,groupid"
855 	},
856 	{"hosts_templates",	"hosttemplateid",	0,
857 		{
858 		{"hosttemplateid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
859 		{"hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | ZBX_PROXY,	ZBX_FK_CASCADE_DELETE},
860 		{"templateid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | ZBX_PROXY,	ZBX_FK_CASCADE_DELETE},
861 		{0}
862 		},
863 		"hostid,templateid"
864 	},
865 	{"items_applications",	"itemappid",	0,
866 		{
867 		{"itemappid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
868 		{"applicationid",	NULL,	"applications",	"applicationid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
869 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
870 		{0}
871 		},
872 		"applicationid,itemid"
873 	},
874 	{"mappings",	"mappingid",	0,
875 		{
876 		{"mappingid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
877 		{"valuemapid",	NULL,	"valuemaps",	"valuemapid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
878 		{"value",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
879 		{"newvalue",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
880 		{0}
881 		},
882 		NULL
883 	},
884 	{"media",	"mediaid",	0,
885 		{
886 		{"mediaid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
887 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
888 		{"mediatypeid",	NULL,	"media_type",	"mediatypeid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
889 		{"sendto",	"",	NULL,	NULL,	1024,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
890 		{"active",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
891 		{"severity",	"63",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
892 		{"period",	"1-7,00:00-24:00",	NULL,	NULL,	1024,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
893 		{0}
894 		},
895 		NULL
896 	},
897 	{"rights",	"rightid",	0,
898 		{
899 		{"rightid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
900 		{"groupid",	NULL,	"usrgrp",	"usrgrpid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
901 		{"permission",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
902 		{"id",	NULL,	"hstgrp",	"groupid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
903 		{0}
904 		},
905 		NULL
906 	},
907 	{"services",	"serviceid",	0,
908 		{
909 		{"serviceid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
910 		{"name",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
911 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
912 		{"algorithm",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
913 		{"triggerid",	NULL,	"triggers",	"triggerid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
914 		{"showsla",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
915 		{"goodsla",	"99.9",	NULL,	NULL,	0,	ZBX_TYPE_FLOAT,	ZBX_NOTNULL,	0},
916 		{"sortorder",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
917 		{0}
918 		},
919 		NULL
920 	},
921 	{"services_links",	"linkid",	0,
922 		{
923 		{"linkid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
924 		{"serviceupid",	NULL,	"services",	"serviceid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
925 		{"servicedownid",	NULL,	"services",	"serviceid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
926 		{"soft",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
927 		{0}
928 		},
929 		"serviceupid,servicedownid"
930 	},
931 	{"services_times",	"timeid",	0,
932 		{
933 		{"timeid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
934 		{"serviceid",	NULL,	"services",	"serviceid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
935 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
936 		{"ts_from",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
937 		{"ts_to",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
938 		{"note",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
939 		{0}
940 		},
941 		NULL
942 	},
943 	{"icon_map",	"iconmapid",	0,
944 		{
945 		{"iconmapid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
946 		{"name",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
947 		{"default_iconid",	NULL,	"images",	"imageid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
948 		{0}
949 		},
950 		"name"
951 	},
952 	{"icon_mapping",	"iconmappingid",	0,
953 		{
954 		{"iconmappingid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
955 		{"iconmapid",	NULL,	"icon_map",	"iconmapid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
956 		{"iconid",	NULL,	"images",	"imageid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
957 		{"inventory_link",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
958 		{"expression",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
959 		{"sortorder",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
960 		{0}
961 		},
962 		NULL
963 	},
964 	{"sysmaps",	"sysmapid",	0,
965 		{
966 		{"sysmapid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
967 		{"name",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
968 		{"width",	"600",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
969 		{"height",	"400",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
970 		{"backgroundid",	NULL,	"images",	"imageid",	0,	ZBX_TYPE_ID,	0,	0},
971 		{"label_type",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
972 		{"label_location",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
973 		{"highlight",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
974 		{"expandproblem",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
975 		{"markelements",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
976 		{"show_unack",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
977 		{"grid_size",	"50",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
978 		{"grid_show",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
979 		{"grid_align",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
980 		{"label_format",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
981 		{"label_type_host",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
982 		{"label_type_hostgroup",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
983 		{"label_type_trigger",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
984 		{"label_type_map",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
985 		{"label_type_image",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
986 		{"label_string_host",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
987 		{"label_string_hostgroup",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
988 		{"label_string_trigger",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
989 		{"label_string_map",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
990 		{"label_string_image",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
991 		{"iconmapid",	NULL,	"icon_map",	"iconmapid",	0,	ZBX_TYPE_ID,	0,	0},
992 		{"expand_macros",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
993 		{"severity_min",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
994 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
995 		{"private",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
996 		{"show_suppressed",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
997 		{0}
998 		},
999 		"name"
1000 	},
1001 	{"sysmaps_elements",	"selementid",	0,
1002 		{
1003 		{"selementid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1004 		{"sysmapid",	NULL,	"sysmaps",	"sysmapid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1005 		{"elementid",	"0",	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1006 		{"elementtype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1007 		{"iconid_off",	NULL,	"images",	"imageid",	0,	ZBX_TYPE_ID,	0,	0},
1008 		{"iconid_on",	NULL,	"images",	"imageid",	0,	ZBX_TYPE_ID,	0,	0},
1009 		{"label",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1010 		{"label_location",	"-1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1011 		{"x",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1012 		{"y",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1013 		{"iconid_disabled",	NULL,	"images",	"imageid",	0,	ZBX_TYPE_ID,	0,	0},
1014 		{"iconid_maintenance",	NULL,	"images",	"imageid",	0,	ZBX_TYPE_ID,	0,	0},
1015 		{"elementsubtype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1016 		{"areatype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1017 		{"width",	"200",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1018 		{"height",	"200",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1019 		{"viewtype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1020 		{"use_iconmap",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1021 		{"application",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1022 		{0}
1023 		},
1024 		NULL
1025 	},
1026 	{"sysmaps_links",	"linkid",	0,
1027 		{
1028 		{"linkid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1029 		{"sysmapid",	NULL,	"sysmaps",	"sysmapid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1030 		{"selementid1",	NULL,	"sysmaps_elements",	"selementid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1031 		{"selementid2",	NULL,	"sysmaps_elements",	"selementid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1032 		{"drawtype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1033 		{"color",	"000000",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1034 		{"label",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1035 		{0}
1036 		},
1037 		NULL
1038 	},
1039 	{"sysmaps_link_triggers",	"linktriggerid",	0,
1040 		{
1041 		{"linktriggerid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1042 		{"linkid",	NULL,	"sysmaps_links",	"linkid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1043 		{"triggerid",	NULL,	"triggers",	"triggerid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1044 		{"drawtype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1045 		{"color",	"000000",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1046 		{0}
1047 		},
1048 		"linkid,triggerid"
1049 	},
1050 	{"sysmap_element_url",	"sysmapelementurlid",	0,
1051 		{
1052 		{"sysmapelementurlid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1053 		{"selementid",	NULL,	"sysmaps_elements",	"selementid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1054 		{"name",	NULL,	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1055 		{"url",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1056 		{0}
1057 		},
1058 		"selementid,name"
1059 	},
1060 	{"sysmap_url",	"sysmapurlid",	0,
1061 		{
1062 		{"sysmapurlid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1063 		{"sysmapid",	NULL,	"sysmaps",	"sysmapid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1064 		{"name",	NULL,	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1065 		{"url",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1066 		{"elementtype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1067 		{0}
1068 		},
1069 		"sysmapid,name"
1070 	},
1071 	{"sysmap_user",	"sysmapuserid",	0,
1072 		{
1073 		{"sysmapuserid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1074 		{"sysmapid",	NULL,	"sysmaps",	"sysmapid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1075 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1076 		{"permission",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1077 		{0}
1078 		},
1079 		"sysmapid,userid"
1080 	},
1081 	{"sysmap_usrgrp",	"sysmapusrgrpid",	0,
1082 		{
1083 		{"sysmapusrgrpid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1084 		{"sysmapid",	NULL,	"sysmaps",	"sysmapid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1085 		{"usrgrpid",	NULL,	"usrgrp",	"usrgrpid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1086 		{"permission",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1087 		{0}
1088 		},
1089 		"sysmapid,usrgrpid"
1090 	},
1091 	{"maintenances_hosts",	"maintenance_hostid",	0,
1092 		{
1093 		{"maintenance_hostid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1094 		{"maintenanceid",	NULL,	"maintenances",	"maintenanceid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1095 		{"hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1096 		{0}
1097 		},
1098 		"maintenanceid,hostid"
1099 	},
1100 	{"maintenances_groups",	"maintenance_groupid",	0,
1101 		{
1102 		{"maintenance_groupid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1103 		{"maintenanceid",	NULL,	"maintenances",	"maintenanceid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1104 		{"groupid",	NULL,	"hstgrp",	"groupid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1105 		{0}
1106 		},
1107 		"maintenanceid,groupid"
1108 	},
1109 	{"timeperiods",	"timeperiodid",	0,
1110 		{
1111 		{"timeperiodid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1112 		{"timeperiod_type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1113 		{"every",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1114 		{"month",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1115 		{"dayofweek",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1116 		{"day",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1117 		{"start_time",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1118 		{"period",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1119 		{"start_date",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1120 		{0}
1121 		},
1122 		NULL
1123 	},
1124 	{"maintenances_windows",	"maintenance_timeperiodid",	0,
1125 		{
1126 		{"maintenance_timeperiodid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1127 		{"maintenanceid",	NULL,	"maintenances",	"maintenanceid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1128 		{"timeperiodid",	NULL,	"timeperiods",	"timeperiodid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1129 		{0}
1130 		},
1131 		"maintenanceid,timeperiodid"
1132 	},
1133 	{"regexps",	"regexpid",	0,
1134 		{
1135 		{"regexpid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1136 		{"name",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
1137 		{"test_string",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
1138 		{0}
1139 		},
1140 		"name"
1141 	},
1142 	{"expressions",	"expressionid",	0,
1143 		{
1144 		{"expressionid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1145 		{"regexpid",	NULL,	"regexps",	"regexpid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | ZBX_PROXY,	ZBX_FK_CASCADE_DELETE},
1146 		{"expression",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
1147 		{"expression_type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
1148 		{"exp_delimiter",	"",	NULL,	NULL,	1,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
1149 		{"case_sensitive",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
1150 		{0}
1151 		},
1152 		NULL
1153 	},
1154 	{"ids",	"table_name,field_name",	0,
1155 		{
1156 		{"table_name",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1157 		{"field_name",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1158 		{"nextid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1159 		{0}
1160 		},
1161 		NULL
1162 	},
1163 	{"alerts",	"alertid",	0,
1164 		{
1165 		{"alertid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1166 		{"actionid",	NULL,	"actions",	"actionid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1167 		{"eventid",	NULL,	"events",	"eventid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1168 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1169 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1170 		{"mediatypeid",	NULL,	"media_type",	"mediatypeid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1171 		{"sendto",	"",	NULL,	NULL,	1024,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1172 		{"subject",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1173 		{"message",	"",	NULL,	NULL,	ZBX_TYPE_TEXT_LEN,	ZBX_TYPE_TEXT,	ZBX_NOTNULL,	0},
1174 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1175 		{"retries",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1176 		{"error",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1177 		{"esc_step",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1178 		{"alerttype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1179 		{"p_eventid",	NULL,	"events",	"eventid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1180 		{"acknowledgeid",	NULL,	"acknowledges",	"acknowledgeid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1181 		{0}
1182 		},
1183 		NULL
1184 	},
1185 	{"history",	"",	0,
1186 		{
1187 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1188 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1189 		{"value",	"0.0000",	NULL,	NULL,	0,	ZBX_TYPE_FLOAT,	ZBX_NOTNULL,	0},
1190 		{"ns",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1191 		{0}
1192 		},
1193 		NULL
1194 	},
1195 	{"history_uint",	"",	0,
1196 		{
1197 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1198 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1199 		{"value",	"0",	NULL,	NULL,	0,	ZBX_TYPE_UINT,	ZBX_NOTNULL,	0},
1200 		{"ns",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1201 		{0}
1202 		},
1203 		NULL
1204 	},
1205 	{"history_str",	"",	0,
1206 		{
1207 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1208 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1209 		{"value",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1210 		{"ns",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1211 		{0}
1212 		},
1213 		NULL
1214 	},
1215 	{"history_log",	"",	0,
1216 		{
1217 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1218 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1219 		{"timestamp",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1220 		{"source",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1221 		{"severity",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1222 		{"value",	"",	NULL,	NULL,	ZBX_TYPE_TEXT_LEN,	ZBX_TYPE_TEXT,	ZBX_NOTNULL,	0},
1223 		{"logeventid",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1224 		{"ns",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1225 		{0}
1226 		},
1227 		NULL
1228 	},
1229 	{"history_text",	"",	0,
1230 		{
1231 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1232 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1233 		{"value",	"",	NULL,	NULL,	ZBX_TYPE_TEXT_LEN,	ZBX_TYPE_TEXT,	ZBX_NOTNULL,	0},
1234 		{"ns",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1235 		{0}
1236 		},
1237 		NULL
1238 	},
1239 	{"proxy_history",	"id",	0,
1240 		{
1241 		{"id",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_UINT,	ZBX_NOTNULL,	0},
1242 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1243 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1244 		{"timestamp",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1245 		{"source",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1246 		{"severity",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1247 		{"value",	"",	NULL,	NULL,	ZBX_TYPE_LONGTEXT_LEN,	ZBX_TYPE_LONGTEXT,	ZBX_NOTNULL,	0},
1248 		{"logeventid",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1249 		{"ns",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1250 		{"state",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1251 		{"lastlogsize",	"0",	NULL,	NULL,	0,	ZBX_TYPE_UINT,	ZBX_NOTNULL,	0},
1252 		{"mtime",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1253 		{"flags",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1254 		{0}
1255 		},
1256 		NULL
1257 	},
1258 	{"proxy_dhistory",	"id",	0,
1259 		{
1260 		{"id",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_UINT,	ZBX_NOTNULL,	0},
1261 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1262 		{"druleid",	NULL,	"drules",	"druleid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1263 		{"ip",	"",	NULL,	NULL,	39,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1264 		{"port",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1265 		{"value",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1266 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1267 		{"dcheckid",	NULL,	"dchecks",	"dcheckid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1268 		{"dns",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1269 		{0}
1270 		},
1271 		NULL
1272 	},
1273 	{"events",	"eventid",	0,
1274 		{
1275 		{"eventid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1276 		{"source",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1277 		{"object",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1278 		{"objectid",	"0",	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1279 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1280 		{"value",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1281 		{"acknowledged",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1282 		{"ns",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1283 		{"name",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1284 		{"severity",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1285 		{0}
1286 		},
1287 		NULL
1288 	},
1289 	{"trends",	"itemid,clock",	0,
1290 		{
1291 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1292 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1293 		{"num",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1294 		{"value_min",	"0.0000",	NULL,	NULL,	0,	ZBX_TYPE_FLOAT,	ZBX_NOTNULL,	0},
1295 		{"value_avg",	"0.0000",	NULL,	NULL,	0,	ZBX_TYPE_FLOAT,	ZBX_NOTNULL,	0},
1296 		{"value_max",	"0.0000",	NULL,	NULL,	0,	ZBX_TYPE_FLOAT,	ZBX_NOTNULL,	0},
1297 		{0}
1298 		},
1299 		NULL
1300 	},
1301 	{"trends_uint",	"itemid,clock",	0,
1302 		{
1303 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1304 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1305 		{"num",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1306 		{"value_min",	"0",	NULL,	NULL,	0,	ZBX_TYPE_UINT,	ZBX_NOTNULL,	0},
1307 		{"value_avg",	"0",	NULL,	NULL,	0,	ZBX_TYPE_UINT,	ZBX_NOTNULL,	0},
1308 		{"value_max",	"0",	NULL,	NULL,	0,	ZBX_TYPE_UINT,	ZBX_NOTNULL,	0},
1309 		{0}
1310 		},
1311 		NULL
1312 	},
1313 	{"acknowledges",	"acknowledgeid",	0,
1314 		{
1315 		{"acknowledgeid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1316 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1317 		{"eventid",	NULL,	"events",	"eventid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1318 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1319 		{"message",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1320 		{"action",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1321 		{"old_severity",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1322 		{"new_severity",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1323 		{0}
1324 		},
1325 		NULL
1326 	},
1327 	{"auditlog",	"auditid",	0,
1328 		{
1329 		{"auditid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1330 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1331 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1332 		{"action",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1333 		{"resourcetype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1334 		{"details",	"0",	NULL,	NULL,	128 ,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1335 		{"ip",	"",	NULL,	NULL,	39,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1336 		{"resourceid",	"0",	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1337 		{"resourcename",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1338 		{0}
1339 		},
1340 		NULL
1341 	},
1342 	{"auditlog_details",	"auditdetailid",	0,
1343 		{
1344 		{"auditdetailid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1345 		{"auditid",	NULL,	"auditlog",	"auditid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1346 		{"table_name",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1347 		{"field_name",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1348 		{"oldvalue",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
1349 		{"newvalue",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
1350 		{0}
1351 		},
1352 		NULL
1353 	},
1354 	{"service_alarms",	"servicealarmid",	0,
1355 		{
1356 		{"servicealarmid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1357 		{"serviceid",	NULL,	"services",	"serviceid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1358 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1359 		{"value",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1360 		{0}
1361 		},
1362 		NULL
1363 	},
1364 	{"autoreg_host",	"autoreg_hostid",	0,
1365 		{
1366 		{"autoreg_hostid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1367 		{"proxy_hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1368 		{"host",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1369 		{"listen_ip",	"",	NULL,	NULL,	39,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1370 		{"listen_port",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1371 		{"listen_dns",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1372 		{"host_metadata",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1373 		{0}
1374 		},
1375 		NULL
1376 	},
1377 	{"proxy_autoreg_host",	"id",	0,
1378 		{
1379 		{"id",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_UINT,	ZBX_NOTNULL,	0},
1380 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1381 		{"host",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1382 		{"listen_ip",	"",	NULL,	NULL,	39,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1383 		{"listen_port",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1384 		{"listen_dns",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1385 		{"host_metadata",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1386 		{0}
1387 		},
1388 		NULL
1389 	},
1390 	{"dhosts",	"dhostid",	0,
1391 		{
1392 		{"dhostid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1393 		{"druleid",	NULL,	"drules",	"druleid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1394 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1395 		{"lastup",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1396 		{"lastdown",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1397 		{0}
1398 		},
1399 		NULL
1400 	},
1401 	{"dservices",	"dserviceid",	0,
1402 		{
1403 		{"dserviceid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1404 		{"dhostid",	NULL,	"dhosts",	"dhostid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1405 		{"value",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1406 		{"port",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1407 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1408 		{"lastup",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1409 		{"lastdown",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1410 		{"dcheckid",	NULL,	"dchecks",	"dcheckid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1411 		{"ip",	"",	NULL,	NULL,	39,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1412 		{"dns",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1413 		{0}
1414 		},
1415 		"dcheckid,ip,port"
1416 	},
1417 	{"escalations",	"escalationid",	0,
1418 		{
1419 		{"escalationid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1420 		{"actionid",	NULL,	"actions",	"actionid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1421 		{"triggerid",	NULL,	"triggers",	"triggerid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1422 		{"eventid",	NULL,	"events",	"eventid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1423 		{"r_eventid",	NULL,	"events",	"eventid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1424 		{"nextcheck",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1425 		{"esc_step",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1426 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1427 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1428 		{"acknowledgeid",	NULL,	"acknowledges",	"acknowledgeid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1429 		{0}
1430 		},
1431 		"triggerid,itemid,escalationid"
1432 	},
1433 	{"globalvars",	"globalvarid",	0,
1434 		{
1435 		{"globalvarid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1436 		{"snmp_lastsize",	"0",	NULL,	NULL,	0,	ZBX_TYPE_UINT,	ZBX_NOTNULL,	0},
1437 		{0}
1438 		},
1439 		NULL
1440 	},
1441 	{"graph_discovery",	"graphid",	0,
1442 		{
1443 		{"graphid",	NULL,	"graphs",	"graphid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1444 		{"parent_graphid",	NULL,	"graphs",	"graphid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1445 		{0}
1446 		},
1447 		NULL
1448 	},
1449 	{"host_inventory",	"hostid",	0,
1450 		{
1451 		{"hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1452 		{"inventory_mode",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1453 		{"type",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1454 		{"type_full",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1455 		{"name",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1456 		{"alias",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1457 		{"os",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1458 		{"os_full",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1459 		{"os_short",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1460 		{"serialno_a",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1461 		{"serialno_b",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1462 		{"tag",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1463 		{"asset_tag",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1464 		{"macaddress_a",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1465 		{"macaddress_b",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1466 		{"hardware",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1467 		{"hardware_full",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
1468 		{"software",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1469 		{"software_full",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
1470 		{"software_app_a",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1471 		{"software_app_b",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1472 		{"software_app_c",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1473 		{"software_app_d",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1474 		{"software_app_e",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1475 		{"contact",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
1476 		{"location",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
1477 		{"location_lat",	"",	NULL,	NULL,	16,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1478 		{"location_lon",	"",	NULL,	NULL,	16,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1479 		{"notes",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
1480 		{"chassis",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1481 		{"model",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1482 		{"hw_arch",	"",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1483 		{"vendor",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1484 		{"contract_number",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1485 		{"installer_name",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1486 		{"deployment_status",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1487 		{"url_a",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1488 		{"url_b",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1489 		{"url_c",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1490 		{"host_networks",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
1491 		{"host_netmask",	"",	NULL,	NULL,	39,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1492 		{"host_router",	"",	NULL,	NULL,	39,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1493 		{"oob_ip",	"",	NULL,	NULL,	39,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1494 		{"oob_netmask",	"",	NULL,	NULL,	39,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1495 		{"oob_router",	"",	NULL,	NULL,	39,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1496 		{"date_hw_purchase",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1497 		{"date_hw_install",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1498 		{"date_hw_expiry",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1499 		{"date_hw_decomm",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1500 		{"site_address_a",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1501 		{"site_address_b",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1502 		{"site_address_c",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1503 		{"site_city",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1504 		{"site_state",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1505 		{"site_country",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1506 		{"site_zip",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1507 		{"site_rack",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1508 		{"site_notes",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
1509 		{"poc_1_name",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1510 		{"poc_1_email",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1511 		{"poc_1_phone_a",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1512 		{"poc_1_phone_b",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1513 		{"poc_1_cell",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1514 		{"poc_1_screen",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1515 		{"poc_1_notes",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
1516 		{"poc_2_name",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1517 		{"poc_2_email",	"",	NULL,	NULL,	128,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1518 		{"poc_2_phone_a",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1519 		{"poc_2_phone_b",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1520 		{"poc_2_cell",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1521 		{"poc_2_screen",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1522 		{"poc_2_notes",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
1523 		{0}
1524 		},
1525 		NULL
1526 	},
1527 	{"housekeeper",	"housekeeperid",	0,
1528 		{
1529 		{"housekeeperid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1530 		{"tablename",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1531 		{"field",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1532 		{"value",	NULL,	"items",	"value",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1533 		{0}
1534 		},
1535 		NULL
1536 	},
1537 	{"images",	"imageid",	0,
1538 		{
1539 		{"imageid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1540 		{"imagetype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1541 		{"name",	"0",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1542 		{"image",	"",	NULL,	NULL,	0,	ZBX_TYPE_BLOB,	ZBX_NOTNULL,	0},
1543 		{0}
1544 		},
1545 		"name"
1546 	},
1547 	{"item_discovery",	"itemdiscoveryid",	0,
1548 		{
1549 		{"itemdiscoveryid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1550 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1551 		{"parent_itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1552 		{"key_",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1553 		{"lastcheck",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1554 		{"ts_delete",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1555 		{0}
1556 		},
1557 		"itemid,parent_itemid"
1558 	},
1559 	{"host_discovery",	"hostid",	0,
1560 		{
1561 		{"hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1562 		{"parent_hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	0,	0},
1563 		{"parent_itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	0,	0},
1564 		{"host",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1565 		{"lastcheck",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1566 		{"ts_delete",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1567 		{0}
1568 		},
1569 		NULL
1570 	},
1571 	{"interface_discovery",	"interfaceid",	0,
1572 		{
1573 		{"interfaceid",	NULL,	"interface",	"interfaceid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1574 		{"parent_interfaceid",	NULL,	"interface",	"interfaceid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1575 		{0}
1576 		},
1577 		NULL
1578 	},
1579 	{"profiles",	"profileid",	0,
1580 		{
1581 		{"profileid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1582 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1583 		{"idx",	"",	NULL,	NULL,	96,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1584 		{"idx2",	"0",	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1585 		{"value_id",	"0",	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1586 		{"value_int",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1587 		{"value_str",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1588 		{"source",	"",	NULL,	NULL,	96,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1589 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1590 		{0}
1591 		},
1592 		NULL
1593 	},
1594 	{"sessions",	"sessionid",	0,
1595 		{
1596 		{"sessionid",	"",	NULL,	NULL,	32,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1597 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1598 		{"lastaccess",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1599 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1600 		{0}
1601 		},
1602 		NULL
1603 	},
1604 	{"trigger_discovery",	"triggerid",	0,
1605 		{
1606 		{"triggerid",	NULL,	"triggers",	"triggerid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1607 		{"parent_triggerid",	NULL,	"triggers",	"triggerid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1608 		{0}
1609 		},
1610 		NULL
1611 	},
1612 	{"application_template",	"application_templateid",	0,
1613 		{
1614 		{"application_templateid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1615 		{"applicationid",	NULL,	"applications",	"applicationid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1616 		{"templateid",	NULL,	"applications",	"applicationid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1617 		{0}
1618 		},
1619 		"applicationid,templateid"
1620 	},
1621 	{"item_condition",	"item_conditionid",	0,
1622 		{
1623 		{"item_conditionid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1624 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1625 		{"operator",	"8",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1626 		{"macro",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1627 		{"value",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1628 		{0}
1629 		},
1630 		NULL
1631 	},
1632 	{"application_prototype",	"application_prototypeid",	0,
1633 		{
1634 		{"application_prototypeid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1635 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1636 		{"templateid",	NULL,	"application_prototype",	"application_prototypeid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1637 		{"name",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1638 		{0}
1639 		},
1640 		NULL
1641 	},
1642 	{"item_application_prototype",	"item_application_prototypeid",	0,
1643 		{
1644 		{"item_application_prototypeid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1645 		{"application_prototypeid",	NULL,	"application_prototype",	"application_prototypeid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1646 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1647 		{0}
1648 		},
1649 		"application_prototypeid,itemid"
1650 	},
1651 	{"application_discovery",	"application_discoveryid",	0,
1652 		{
1653 		{"application_discoveryid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1654 		{"applicationid",	NULL,	"applications",	"applicationid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1655 		{"application_prototypeid",	NULL,	"application_prototype",	"application_prototypeid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1656 		{"name",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1657 		{"lastcheck",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1658 		{"ts_delete",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1659 		{0}
1660 		},
1661 		NULL
1662 	},
1663 	{"opinventory",	"operationid",	0,
1664 		{
1665 		{"operationid",	NULL,	"operations",	"operationid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1666 		{"inventory_mode",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1667 		{0}
1668 		},
1669 		NULL
1670 	},
1671 	{"trigger_tag",	"triggertagid",	0,
1672 		{
1673 		{"triggertagid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1674 		{"triggerid",	NULL,	"triggers",	"triggerid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1675 		{"tag",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1676 		{"value",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1677 		{0}
1678 		},
1679 		NULL
1680 	},
1681 	{"event_tag",	"eventtagid",	0,
1682 		{
1683 		{"eventtagid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1684 		{"eventid",	NULL,	"events",	"eventid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1685 		{"tag",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1686 		{"value",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1687 		{0}
1688 		},
1689 		NULL
1690 	},
1691 	{"problem",	"eventid",	0,
1692 		{
1693 		{"eventid",	NULL,	"events",	"eventid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1694 		{"source",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1695 		{"object",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1696 		{"objectid",	"0",	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1697 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1698 		{"ns",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1699 		{"r_eventid",	NULL,	"events",	"eventid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1700 		{"r_clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1701 		{"r_ns",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1702 		{"correlationid",	NULL,	"correlation",	"correlationid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1703 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1704 		{"name",	"",	NULL,	NULL,	2048,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1705 		{"acknowledged",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1706 		{"severity",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1707 		{0}
1708 		},
1709 		NULL
1710 	},
1711 	{"problem_tag",	"problemtagid",	0,
1712 		{
1713 		{"problemtagid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1714 		{"eventid",	NULL,	"problem",	"eventid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1715 		{"tag",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1716 		{"value",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1717 		{0}
1718 		},
1719 		NULL
1720 	},
1721 	{"tag_filter",	"tag_filterid",	0,
1722 		{
1723 		{"tag_filterid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1724 		{"usrgrpid",	NULL,	"usrgrp",	"usrgrpid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | 0 ,	ZBX_FK_CASCADE_DELETE},
1725 		{"groupid",	NULL,	"hstgrp",	"groupid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1726 		{"tag",	" ",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1727 		{"value",	" ",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1728 		{0}
1729 		},
1730 		NULL
1731 	},
1732 	{"event_recovery",	"eventid",	0,
1733 		{
1734 		{"eventid",	NULL,	"events",	"eventid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1735 		{"r_eventid",	NULL,	"events",	"eventid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1736 		{"c_eventid",	NULL,	"events",	"eventid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1737 		{"correlationid",	NULL,	"correlation",	"correlationid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1738 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1739 		{0}
1740 		},
1741 		NULL
1742 	},
1743 	{"correlation",	"correlationid",	0,
1744 		{
1745 		{"correlationid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1746 		{"name",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1747 		{"description",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
1748 		{"evaltype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1749 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1750 		{"formula",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1751 		{0}
1752 		},
1753 		"name"
1754 	},
1755 	{"corr_condition",	"corr_conditionid",	0,
1756 		{
1757 		{"corr_conditionid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1758 		{"correlationid",	NULL,	"correlation",	"correlationid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1759 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1760 		{0}
1761 		},
1762 		NULL
1763 	},
1764 	{"corr_condition_tag",	"corr_conditionid",	0,
1765 		{
1766 		{"corr_conditionid",	NULL,	"corr_condition",	"corr_conditionid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1767 		{"tag",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1768 		{0}
1769 		},
1770 		NULL
1771 	},
1772 	{"corr_condition_group",	"corr_conditionid",	0,
1773 		{
1774 		{"corr_conditionid",	NULL,	"corr_condition",	"corr_conditionid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1775 		{"operator",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1776 		{"groupid",	NULL,	"hstgrp",	"groupid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1777 		{0}
1778 		},
1779 		NULL
1780 	},
1781 	{"corr_condition_tagpair",	"corr_conditionid",	0,
1782 		{
1783 		{"corr_conditionid",	NULL,	"corr_condition",	"corr_conditionid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1784 		{"oldtag",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1785 		{"newtag",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1786 		{0}
1787 		},
1788 		NULL
1789 	},
1790 	{"corr_condition_tagvalue",	"corr_conditionid",	0,
1791 		{
1792 		{"corr_conditionid",	NULL,	"corr_condition",	"corr_conditionid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1793 		{"tag",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1794 		{"operator",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1795 		{"value",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1796 		{0}
1797 		},
1798 		NULL
1799 	},
1800 	{"corr_operation",	"corr_operationid",	0,
1801 		{
1802 		{"corr_operationid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1803 		{"correlationid",	NULL,	"correlation",	"correlationid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1804 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1805 		{0}
1806 		},
1807 		NULL
1808 	},
1809 	{"task",	"taskid",	0,
1810 		{
1811 		{"taskid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1812 		{"type",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1813 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1814 		{"clock",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1815 		{"ttl",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1816 		{"proxy_hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1817 		{0}
1818 		},
1819 		NULL
1820 	},
1821 	{"task_close_problem",	"taskid",	0,
1822 		{
1823 		{"taskid",	NULL,	"task",	"taskid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1824 		{"acknowledgeid",	NULL,	"acknowledges",	"acknowledgeid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1825 		{0}
1826 		},
1827 		NULL
1828 	},
1829 	{"item_preproc",	"item_preprocid",	0,
1830 		{
1831 		{"item_preprocid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1832 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1833 		{"step",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1834 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1835 		{"params",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1836 		{0}
1837 		},
1838 		NULL
1839 	},
1840 	{"task_remote_command",	"taskid",	0,
1841 		{
1842 		{"taskid",	NULL,	"task",	"taskid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1843 		{"command_type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1844 		{"execute_on",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1845 		{"port",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1846 		{"authtype",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1847 		{"username",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1848 		{"password",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1849 		{"publickey",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1850 		{"privatekey",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1851 		{"command",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
1852 		{"alertid",	NULL,	"alerts",	"alertid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1853 		{"parent_taskid",	NULL,	"task",	"taskid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1854 		{"hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1855 		{0}
1856 		},
1857 		NULL
1858 	},
1859 	{"task_remote_command_result",	"taskid",	0,
1860 		{
1861 		{"taskid",	NULL,	"task",	"taskid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1862 		{"status",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1863 		{"parent_taskid",	NULL,	"task",	"taskid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1864 		{"info",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
1865 		{0}
1866 		},
1867 		NULL
1868 	},
1869 	{"task_acknowledge",	"taskid",	0,
1870 		{
1871 		{"taskid",	NULL,	"task",	"taskid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1872 		{"acknowledgeid",	NULL,	"acknowledges",	"acknowledgeid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1873 		{0}
1874 		},
1875 		NULL
1876 	},
1877 	{"sysmap_shape",	"sysmap_shapeid",	0,
1878 		{
1879 		{"sysmap_shapeid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1880 		{"sysmapid",	NULL,	"sysmaps",	"sysmapid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1881 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1882 		{"x",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1883 		{"y",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1884 		{"width",	"200",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1885 		{"height",	"200",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1886 		{"text",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL,	0},
1887 		{"font",	"9",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1888 		{"font_size",	"11",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1889 		{"font_color",	"000000",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1890 		{"text_halign",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1891 		{"text_valign",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1892 		{"border_type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1893 		{"border_width",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1894 		{"border_color",	"000000",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1895 		{"background_color",	"",	NULL,	NULL,	6,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1896 		{"zindex",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1897 		{0}
1898 		},
1899 		NULL
1900 	},
1901 	{"sysmap_element_trigger",	"selement_triggerid",	0,
1902 		{
1903 		{"selement_triggerid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1904 		{"selementid",	NULL,	"sysmaps_elements",	"selementid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1905 		{"triggerid",	NULL,	"triggers",	"triggerid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1906 		{0}
1907 		},
1908 		"selementid,triggerid"
1909 	},
1910 	{"httptest_field",	"httptest_fieldid",	0,
1911 		{
1912 		{"httptest_fieldid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1913 		{"httptestid",	NULL,	"httptest",	"httptestid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | ZBX_PROXY,	ZBX_FK_CASCADE_DELETE},
1914 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
1915 		{"name",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
1916 		{"value",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL | ZBX_PROXY,	0},
1917 		{0}
1918 		},
1919 		NULL
1920 	},
1921 	{"httpstep_field",	"httpstep_fieldid",	0,
1922 		{
1923 		{"httpstep_fieldid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1924 		{"httpstepid",	NULL,	"httpstep",	"httpstepid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL | ZBX_PROXY,	ZBX_FK_CASCADE_DELETE},
1925 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
1926 		{"name",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
1927 		{"value",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL | ZBX_PROXY,	0},
1928 		{0}
1929 		},
1930 		NULL
1931 	},
1932 	{"dashboard",	"dashboardid",	0,
1933 		{
1934 		{"dashboardid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1935 		{"name",	NULL,	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1936 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1937 		{"private",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1938 		{0}
1939 		},
1940 		NULL
1941 	},
1942 	{"dashboard_user",	"dashboard_userid",	0,
1943 		{
1944 		{"dashboard_userid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1945 		{"dashboardid",	NULL,	"dashboard",	"dashboardid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1946 		{"userid",	NULL,	"users",	"userid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1947 		{"permission",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1948 		{0}
1949 		},
1950 		"dashboardid,userid"
1951 	},
1952 	{"dashboard_usrgrp",	"dashboard_usrgrpid",	0,
1953 		{
1954 		{"dashboard_usrgrpid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1955 		{"dashboardid",	NULL,	"dashboard",	"dashboardid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1956 		{"usrgrpid",	NULL,	"usrgrp",	"usrgrpid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1957 		{"permission",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1958 		{0}
1959 		},
1960 		"dashboardid,usrgrpid"
1961 	},
1962 	{"widget",	"widgetid",	0,
1963 		{
1964 		{"widgetid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1965 		{"dashboardid",	NULL,	"dashboard",	"dashboardid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1966 		{"type",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1967 		{"name",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1968 		{"x",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1969 		{"y",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1970 		{"width",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1971 		{"height",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1972 		{0}
1973 		},
1974 		NULL
1975 	},
1976 	{"widget_field",	"widget_fieldid",	0,
1977 		{
1978 		{"widget_fieldid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
1979 		{"widgetid",	NULL,	"widget",	"widgetid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1980 		{"type",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1981 		{"name",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1982 		{"value_int",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
1983 		{"value_str",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
1984 		{"value_groupid",	NULL,	"hstgrp",	"groupid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1985 		{"value_hostid",	NULL,	"hosts",	"hostid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1986 		{"value_itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1987 		{"value_graphid",	NULL,	"graphs",	"graphid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1988 		{"value_sysmapid",	NULL,	"sysmaps",	"sysmapid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
1989 		{0}
1990 		},
1991 		NULL
1992 	},
1993 	{"task_check_now",	"taskid",	0,
1994 		{
1995 		{"taskid",	NULL,	"task",	"taskid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1996 		{"itemid",	NULL,	"items",	"itemid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
1997 		{0}
1998 		},
1999 		NULL
2000 	},
2001 	{"event_suppress",	"event_suppressid",	0,
2002 		{
2003 		{"event_suppressid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
2004 		{"eventid",	NULL,	"events",	"eventid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
2005 		{"maintenanceid",	NULL,	"maintenances",	"maintenanceid",	0,	ZBX_TYPE_ID,	0,	ZBX_FK_CASCADE_DELETE},
2006 		{"suppress_until",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
2007 		{0}
2008 		},
2009 		"eventid,maintenanceid"
2010 	},
2011 	{"maintenance_tag",	"maintenancetagid",	0,
2012 		{
2013 		{"maintenancetagid",	NULL,	NULL,	NULL,	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	0},
2014 		{"maintenanceid",	NULL,	"maintenances",	"maintenanceid",	0,	ZBX_TYPE_ID,	ZBX_NOTNULL,	ZBX_FK_CASCADE_DELETE},
2015 		{"tag",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
2016 		{"operator",	"2",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
2017 		{"value",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL,	0},
2018 		{0}
2019 		},
2020 		NULL
2021 	},
2022 	{"dbversion",	"",	0,
2023 		{
2024 		{"mandatory",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
2025 		{"optional",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL,	0},
2026 		{0}
2027 		},
2028 		NULL
2029 	},
2030 	{0}
2031 
2032 #undef ZBX_TYPE_LONGTEXT_LEN
2033 #undef ZBX_TYPE_SHORTTEXT_LEN
2034 
2035 };
2036 #if defined(HAVE_SQLITE3)
2037 const char	*const db_schema = "\
2038 CREATE TABLE users (\n\
2039 userid bigint  NOT NULL,\n\
2040 alias varchar(100) DEFAULT '' NOT NULL,\n\
2041 name varchar(100) DEFAULT '' NOT NULL,\n\
2042 surname varchar(100) DEFAULT '' NOT NULL,\n\
2043 passwd varchar(32) DEFAULT '' NOT NULL,\n\
2044 url varchar(255) DEFAULT '' NOT NULL,\n\
2045 autologin integer DEFAULT '0' NOT NULL,\n\
2046 autologout varchar(32) DEFAULT '15m' NOT NULL,\n\
2047 lang varchar(5) DEFAULT 'en_GB' NOT NULL,\n\
2048 refresh varchar(32) DEFAULT '30s' NOT NULL,\n\
2049 type integer DEFAULT '1' NOT NULL,\n\
2050 theme varchar(128) DEFAULT 'default' NOT NULL,\n\
2051 attempt_failed integer DEFAULT 0 NOT NULL,\n\
2052 attempt_ip varchar(39) DEFAULT '' NOT NULL,\n\
2053 attempt_clock integer DEFAULT 0 NOT NULL,\n\
2054 rows_per_page integer DEFAULT 50 NOT NULL,\n\
2055 PRIMARY KEY (userid)\n\
2056 );\n\
2057 CREATE UNIQUE INDEX users_1 ON users (alias);\n\
2058 CREATE TABLE maintenances (\n\
2059 maintenanceid bigint  NOT NULL,\n\
2060 name varchar(128) DEFAULT '' NOT NULL,\n\
2061 maintenance_type integer DEFAULT '0' NOT NULL,\n\
2062 description text DEFAULT '' NOT NULL,\n\
2063 active_since integer DEFAULT '0' NOT NULL,\n\
2064 active_till integer DEFAULT '0' NOT NULL,\n\
2065 tags_evaltype integer DEFAULT '0' NOT NULL,\n\
2066 PRIMARY KEY (maintenanceid)\n\
2067 );\n\
2068 CREATE INDEX maintenances_1 ON maintenances (active_since,active_till);\n\
2069 CREATE UNIQUE INDEX maintenances_2 ON maintenances (name);\n\
2070 CREATE TABLE hosts (\n\
2071 hostid bigint  NOT NULL,\n\
2072 proxy_hostid bigint  NULL REFERENCES hosts (hostid),\n\
2073 host varchar(128) DEFAULT '' NOT NULL,\n\
2074 status integer DEFAULT '0' NOT NULL,\n\
2075 disable_until integer DEFAULT '0' NOT NULL,\n\
2076 error varchar(2048) DEFAULT '' NOT NULL,\n\
2077 available integer DEFAULT '0' NOT NULL,\n\
2078 errors_from integer DEFAULT '0' NOT NULL,\n\
2079 lastaccess integer DEFAULT '0' NOT NULL,\n\
2080 ipmi_authtype integer DEFAULT '-1' NOT NULL,\n\
2081 ipmi_privilege integer DEFAULT '2' NOT NULL,\n\
2082 ipmi_username varchar(16) DEFAULT '' NOT NULL,\n\
2083 ipmi_password varchar(20) DEFAULT '' NOT NULL,\n\
2084 ipmi_disable_until integer DEFAULT '0' NOT NULL,\n\
2085 ipmi_available integer DEFAULT '0' NOT NULL,\n\
2086 snmp_disable_until integer DEFAULT '0' NOT NULL,\n\
2087 snmp_available integer DEFAULT '0' NOT NULL,\n\
2088 maintenanceid bigint  NULL REFERENCES maintenances (maintenanceid),\n\
2089 maintenance_status integer DEFAULT '0' NOT NULL,\n\
2090 maintenance_type integer DEFAULT '0' NOT NULL,\n\
2091 maintenance_from integer DEFAULT '0' NOT NULL,\n\
2092 ipmi_errors_from integer DEFAULT '0' NOT NULL,\n\
2093 snmp_errors_from integer DEFAULT '0' NOT NULL,\n\
2094 ipmi_error varchar(2048) DEFAULT '' NOT NULL,\n\
2095 snmp_error varchar(2048) DEFAULT '' NOT NULL,\n\
2096 jmx_disable_until integer DEFAULT '0' NOT NULL,\n\
2097 jmx_available integer DEFAULT '0' NOT NULL,\n\
2098 jmx_errors_from integer DEFAULT '0' NOT NULL,\n\
2099 jmx_error varchar(2048) DEFAULT '' NOT NULL,\n\
2100 name varchar(128) DEFAULT '' NOT NULL,\n\
2101 flags integer DEFAULT '0' NOT NULL,\n\
2102 templateid bigint  NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
2103 description text DEFAULT '' NOT NULL,\n\
2104 tls_connect integer DEFAULT '1' NOT NULL,\n\
2105 tls_accept integer DEFAULT '1' NOT NULL,\n\
2106 tls_issuer varchar(1024) DEFAULT '' NOT NULL,\n\
2107 tls_subject varchar(1024) DEFAULT '' NOT NULL,\n\
2108 tls_psk_identity varchar(128) DEFAULT '' NOT NULL,\n\
2109 tls_psk varchar(512) DEFAULT '' NOT NULL,\n\
2110 proxy_address varchar(255) DEFAULT '' NOT NULL,\n\
2111 auto_compress integer DEFAULT '1' NOT NULL,\n\
2112 PRIMARY KEY (hostid)\n\
2113 );\n\
2114 CREATE INDEX hosts_1 ON hosts (host);\n\
2115 CREATE INDEX hosts_2 ON hosts (status);\n\
2116 CREATE INDEX hosts_3 ON hosts (proxy_hostid);\n\
2117 CREATE INDEX hosts_4 ON hosts (name);\n\
2118 CREATE INDEX hosts_5 ON hosts (maintenanceid);\n\
2119 CREATE TABLE hstgrp (\n\
2120 groupid bigint  NOT NULL,\n\
2121 name varchar(255) DEFAULT '' NOT NULL,\n\
2122 internal integer DEFAULT '0' NOT NULL,\n\
2123 flags integer DEFAULT '0' NOT NULL,\n\
2124 PRIMARY KEY (groupid)\n\
2125 );\n\
2126 CREATE INDEX hstgrp_1 ON hstgrp (name);\n\
2127 CREATE TABLE group_prototype (\n\
2128 group_prototypeid bigint  NOT NULL,\n\
2129 hostid bigint  NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
2130 name varchar(255) DEFAULT '' NOT NULL,\n\
2131 groupid bigint  NULL REFERENCES hstgrp (groupid),\n\
2132 templateid bigint  NULL REFERENCES group_prototype (group_prototypeid) ON DELETE CASCADE,\n\
2133 PRIMARY KEY (group_prototypeid)\n\
2134 );\n\
2135 CREATE INDEX group_prototype_1 ON group_prototype (hostid);\n\
2136 CREATE TABLE group_discovery (\n\
2137 groupid bigint  NOT NULL REFERENCES hstgrp (groupid) ON DELETE CASCADE,\n\
2138 parent_group_prototypeid bigint  NOT NULL REFERENCES group_prototype (group_prototypeid),\n\
2139 name varchar(64) DEFAULT '' NOT NULL,\n\
2140 lastcheck integer DEFAULT '0' NOT NULL,\n\
2141 ts_delete integer DEFAULT '0' NOT NULL,\n\
2142 PRIMARY KEY (groupid)\n\
2143 );\n\
2144 CREATE TABLE screens (\n\
2145 screenid bigint  NOT NULL,\n\
2146 name varchar(255)  NOT NULL,\n\
2147 hsize integer DEFAULT '1' NOT NULL,\n\
2148 vsize integer DEFAULT '1' NOT NULL,\n\
2149 templateid bigint  NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
2150 userid bigint  NULL REFERENCES users (userid),\n\
2151 private integer DEFAULT '1' NOT NULL,\n\
2152 PRIMARY KEY (screenid)\n\
2153 );\n\
2154 CREATE INDEX screens_1 ON screens (templateid);\n\
2155 CREATE TABLE screens_items (\n\
2156 screenitemid bigint  NOT NULL,\n\
2157 screenid bigint  NOT NULL REFERENCES screens (screenid) ON DELETE CASCADE,\n\
2158 resourcetype integer DEFAULT '0' NOT NULL,\n\
2159 resourceid bigint DEFAULT '0' NOT NULL,\n\
2160 width integer DEFAULT '320' NOT NULL,\n\
2161 height integer DEFAULT '200' NOT NULL,\n\
2162 x integer DEFAULT '0' NOT NULL,\n\
2163 y integer DEFAULT '0' NOT NULL,\n\
2164 colspan integer DEFAULT '1' NOT NULL,\n\
2165 rowspan integer DEFAULT '1' NOT NULL,\n\
2166 elements integer DEFAULT '25' NOT NULL,\n\
2167 valign integer DEFAULT '0' NOT NULL,\n\
2168 halign integer DEFAULT '0' NOT NULL,\n\
2169 style integer DEFAULT '0' NOT NULL,\n\
2170 url varchar(255) DEFAULT '' NOT NULL,\n\
2171 dynamic integer DEFAULT '0' NOT NULL,\n\
2172 sort_triggers integer DEFAULT '0' NOT NULL,\n\
2173 application varchar(255) DEFAULT '' NOT NULL,\n\
2174 max_columns integer DEFAULT '3' NOT NULL,\n\
2175 PRIMARY KEY (screenitemid)\n\
2176 );\n\
2177 CREATE INDEX screens_items_1 ON screens_items (screenid);\n\
2178 CREATE TABLE screen_user (\n\
2179 screenuserid bigint  NOT NULL,\n\
2180 screenid bigint  NOT NULL REFERENCES screens (screenid) ON DELETE CASCADE,\n\
2181 userid bigint  NOT NULL REFERENCES users (userid) ON DELETE CASCADE,\n\
2182 permission integer DEFAULT '2' NOT NULL,\n\
2183 PRIMARY KEY (screenuserid)\n\
2184 );\n\
2185 CREATE UNIQUE INDEX screen_user_1 ON screen_user (screenid,userid);\n\
2186 CREATE TABLE screen_usrgrp (\n\
2187 screenusrgrpid bigint  NOT NULL,\n\
2188 screenid bigint  NOT NULL REFERENCES screens (screenid) ON DELETE CASCADE,\n\
2189 usrgrpid bigint  NOT NULL REFERENCES usrgrp (usrgrpid) ON DELETE CASCADE,\n\
2190 permission integer DEFAULT '2' NOT NULL,\n\
2191 PRIMARY KEY (screenusrgrpid)\n\
2192 );\n\
2193 CREATE UNIQUE INDEX screen_usrgrp_1 ON screen_usrgrp (screenid,usrgrpid);\n\
2194 CREATE TABLE slideshows (\n\
2195 slideshowid bigint  NOT NULL,\n\
2196 name varchar(255) DEFAULT '' NOT NULL,\n\
2197 delay varchar(32) DEFAULT '30s' NOT NULL,\n\
2198 userid bigint  NOT NULL REFERENCES users (userid),\n\
2199 private integer DEFAULT '1' NOT NULL,\n\
2200 PRIMARY KEY (slideshowid)\n\
2201 );\n\
2202 CREATE UNIQUE INDEX slideshows_1 ON slideshows (name);\n\
2203 CREATE TABLE slideshow_user (\n\
2204 slideshowuserid bigint  NOT NULL,\n\
2205 slideshowid bigint  NOT NULL REFERENCES slideshows (slideshowid) ON DELETE CASCADE,\n\
2206 userid bigint  NOT NULL REFERENCES users (userid) ON DELETE CASCADE,\n\
2207 permission integer DEFAULT '2' NOT NULL,\n\
2208 PRIMARY KEY (slideshowuserid)\n\
2209 );\n\
2210 CREATE UNIQUE INDEX slideshow_user_1 ON slideshow_user (slideshowid,userid);\n\
2211 CREATE TABLE slideshow_usrgrp (\n\
2212 slideshowusrgrpid bigint  NOT NULL,\n\
2213 slideshowid bigint  NOT NULL REFERENCES slideshows (slideshowid) ON DELETE CASCADE,\n\
2214 usrgrpid bigint  NOT NULL REFERENCES usrgrp (usrgrpid) ON DELETE CASCADE,\n\
2215 permission integer DEFAULT '2' NOT NULL,\n\
2216 PRIMARY KEY (slideshowusrgrpid)\n\
2217 );\n\
2218 CREATE UNIQUE INDEX slideshow_usrgrp_1 ON slideshow_usrgrp (slideshowid,usrgrpid);\n\
2219 CREATE TABLE slides (\n\
2220 slideid bigint  NOT NULL,\n\
2221 slideshowid bigint  NOT NULL REFERENCES slideshows (slideshowid) ON DELETE CASCADE,\n\
2222 screenid bigint  NOT NULL REFERENCES screens (screenid) ON DELETE CASCADE,\n\
2223 step integer DEFAULT '0' NOT NULL,\n\
2224 delay varchar(32) DEFAULT '0' NOT NULL,\n\
2225 PRIMARY KEY (slideid)\n\
2226 );\n\
2227 CREATE INDEX slides_1 ON slides (slideshowid);\n\
2228 CREATE INDEX slides_2 ON slides (screenid);\n\
2229 CREATE TABLE drules (\n\
2230 druleid bigint  NOT NULL,\n\
2231 proxy_hostid bigint  NULL REFERENCES hosts (hostid),\n\
2232 name varchar(255) DEFAULT '' NOT NULL,\n\
2233 iprange varchar(2048) DEFAULT '' NOT NULL,\n\
2234 delay varchar(255) DEFAULT '1h' NOT NULL,\n\
2235 nextcheck integer DEFAULT '0' NOT NULL,\n\
2236 status integer DEFAULT '0' NOT NULL,\n\
2237 PRIMARY KEY (druleid)\n\
2238 );\n\
2239 CREATE INDEX drules_1 ON drules (proxy_hostid);\n\
2240 CREATE UNIQUE INDEX drules_2 ON drules (name);\n\
2241 CREATE TABLE dchecks (\n\
2242 dcheckid bigint  NOT NULL,\n\
2243 druleid bigint  NOT NULL REFERENCES drules (druleid) ON DELETE CASCADE,\n\
2244 type integer DEFAULT '0' NOT NULL,\n\
2245 key_ varchar(512) DEFAULT '' NOT NULL,\n\
2246 snmp_community varchar(255) DEFAULT '' NOT NULL,\n\
2247 ports varchar(255) DEFAULT '0' NOT NULL,\n\
2248 snmpv3_securityname varchar(64) DEFAULT '' NOT NULL,\n\
2249 snmpv3_securitylevel integer DEFAULT '0' NOT NULL,\n\
2250 snmpv3_authpassphrase varchar(64) DEFAULT '' NOT NULL,\n\
2251 snmpv3_privpassphrase varchar(64) DEFAULT '' NOT NULL,\n\
2252 uniq integer DEFAULT '0' NOT NULL,\n\
2253 snmpv3_authprotocol integer DEFAULT '0' NOT NULL,\n\
2254 snmpv3_privprotocol integer DEFAULT '0' NOT NULL,\n\
2255 snmpv3_contextname varchar(255) DEFAULT '' NOT NULL,\n\
2256 PRIMARY KEY (dcheckid)\n\
2257 );\n\
2258 CREATE INDEX dchecks_1 ON dchecks (druleid);\n\
2259 CREATE TABLE applications (\n\
2260 applicationid bigint  NOT NULL,\n\
2261 hostid bigint  NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
2262 name varchar(255) DEFAULT '' NOT NULL,\n\
2263 flags integer DEFAULT '0' NOT NULL,\n\
2264 PRIMARY KEY (applicationid)\n\
2265 );\n\
2266 CREATE UNIQUE INDEX applications_2 ON applications (hostid,name);\n\
2267 CREATE TABLE httptest (\n\
2268 httptestid bigint  NOT NULL,\n\
2269 name varchar(64) DEFAULT '' NOT NULL,\n\
2270 applicationid bigint  NULL REFERENCES applications (applicationid),\n\
2271 nextcheck integer DEFAULT '0' NOT NULL,\n\
2272 delay varchar(255) DEFAULT '1m' NOT NULL,\n\
2273 status integer DEFAULT '0' NOT NULL,\n\
2274 agent varchar(255) DEFAULT 'Zabbix' NOT NULL,\n\
2275 authentication integer DEFAULT '0' NOT NULL,\n\
2276 http_user varchar(64) DEFAULT '' NOT NULL,\n\
2277 http_password varchar(64) DEFAULT '' NOT NULL,\n\
2278 hostid bigint  NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
2279 templateid bigint  NULL REFERENCES httptest (httptestid) ON DELETE CASCADE,\n\
2280 http_proxy varchar(255) DEFAULT '' NOT NULL,\n\
2281 retries integer DEFAULT '1' NOT NULL,\n\
2282 ssl_cert_file varchar(255) DEFAULT '' NOT NULL,\n\
2283 ssl_key_file varchar(255) DEFAULT '' NOT NULL,\n\
2284 ssl_key_password varchar(64) DEFAULT '' NOT NULL,\n\
2285 verify_peer integer DEFAULT '0' NOT NULL,\n\
2286 verify_host integer DEFAULT '0' NOT NULL,\n\
2287 PRIMARY KEY (httptestid)\n\
2288 );\n\
2289 CREATE INDEX httptest_1 ON httptest (applicationid);\n\
2290 CREATE UNIQUE INDEX httptest_2 ON httptest (hostid,name);\n\
2291 CREATE INDEX httptest_3 ON httptest (status);\n\
2292 CREATE INDEX httptest_4 ON httptest (templateid);\n\
2293 CREATE TABLE httpstep (\n\
2294 httpstepid bigint  NOT NULL,\n\
2295 httptestid bigint  NOT NULL REFERENCES httptest (httptestid) ON DELETE CASCADE,\n\
2296 name varchar(64) DEFAULT '' NOT NULL,\n\
2297 no integer DEFAULT '0' NOT NULL,\n\
2298 url varchar(2048) DEFAULT '' NOT NULL,\n\
2299 timeout varchar(255) DEFAULT '15s' NOT NULL,\n\
2300 posts text DEFAULT '' NOT NULL,\n\
2301 required varchar(255) DEFAULT '' NOT NULL,\n\
2302 status_codes varchar(255) DEFAULT '' NOT NULL,\n\
2303 follow_redirects integer DEFAULT '1' NOT NULL,\n\
2304 retrieve_mode integer DEFAULT '0' NOT NULL,\n\
2305 post_type integer DEFAULT '0' NOT NULL,\n\
2306 PRIMARY KEY (httpstepid)\n\
2307 );\n\
2308 CREATE INDEX httpstep_1 ON httpstep (httptestid);\n\
2309 CREATE TABLE interface (\n\
2310 interfaceid bigint  NOT NULL,\n\
2311 hostid bigint  NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
2312 main integer DEFAULT '0' NOT NULL,\n\
2313 type integer DEFAULT '0' NOT NULL,\n\
2314 useip integer DEFAULT '1' NOT NULL,\n\
2315 ip varchar(64) DEFAULT '127.0.0.1' NOT NULL,\n\
2316 dns varchar(255) DEFAULT '' NOT NULL,\n\
2317 port varchar(64) DEFAULT '10050' NOT NULL,\n\
2318 bulk integer DEFAULT '1' NOT NULL,\n\
2319 PRIMARY KEY (interfaceid)\n\
2320 );\n\
2321 CREATE INDEX interface_1 ON interface (hostid,type);\n\
2322 CREATE INDEX interface_2 ON interface (ip,dns);\n\
2323 CREATE TABLE valuemaps (\n\
2324 valuemapid bigint  NOT NULL,\n\
2325 name varchar(64) DEFAULT '' NOT NULL,\n\
2326 PRIMARY KEY (valuemapid)\n\
2327 );\n\
2328 CREATE UNIQUE INDEX valuemaps_1 ON valuemaps (name);\n\
2329 CREATE TABLE items (\n\
2330 itemid bigint  NOT NULL,\n\
2331 type integer DEFAULT '0' NOT NULL,\n\
2332 snmp_community varchar(64) DEFAULT '' NOT NULL,\n\
2333 snmp_oid varchar(512) DEFAULT '' NOT NULL,\n\
2334 hostid bigint  NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
2335 name varchar(255) DEFAULT '' NOT NULL,\n\
2336 key_ varchar(255) DEFAULT '' NOT NULL,\n\
2337 delay varchar(1024) DEFAULT '0' NOT NULL,\n\
2338 history varchar(255) DEFAULT '90d' NOT NULL,\n\
2339 trends varchar(255) DEFAULT '365d' NOT NULL,\n\
2340 status integer DEFAULT '0' NOT NULL,\n\
2341 value_type integer DEFAULT '0' NOT NULL,\n\
2342 trapper_hosts varchar(255) DEFAULT '' NOT NULL,\n\
2343 units varchar(255) DEFAULT '' NOT NULL,\n\
2344 snmpv3_securityname varchar(64) DEFAULT '' NOT NULL,\n\
2345 snmpv3_securitylevel integer DEFAULT '0' NOT NULL,\n\
2346 snmpv3_authpassphrase varchar(64) DEFAULT '' NOT NULL,\n\
2347 snmpv3_privpassphrase varchar(64) DEFAULT '' NOT NULL,\n\
2348 formula varchar(255) DEFAULT '' NOT NULL,\n\
2349 error varchar(2048) DEFAULT '' NOT NULL,\n\
2350 lastlogsize bigint DEFAULT '0' NOT NULL,\n\
2351 logtimefmt varchar(64) DEFAULT '' NOT NULL,\n\
2352 templateid bigint  NULL REFERENCES items (itemid) ON DELETE CASCADE,\n\
2353 valuemapid bigint  NULL REFERENCES valuemaps (valuemapid),\n\
2354 params text DEFAULT '' NOT NULL,\n\
2355 ipmi_sensor varchar(128) DEFAULT '' NOT NULL,\n\
2356 authtype integer DEFAULT '0' NOT NULL,\n\
2357 username varchar(64) DEFAULT '' NOT NULL,\n\
2358 password varchar(64) DEFAULT '' NOT NULL,\n\
2359 publickey varchar(64) DEFAULT '' NOT NULL,\n\
2360 privatekey varchar(64) DEFAULT '' NOT NULL,\n\
2361 mtime integer DEFAULT '0' NOT NULL,\n\
2362 flags integer DEFAULT '0' NOT NULL,\n\
2363 interfaceid bigint  NULL REFERENCES interface (interfaceid),\n\
2364 port varchar(64) DEFAULT '' NOT NULL,\n\
2365 description text DEFAULT '' NOT NULL,\n\
2366 inventory_link integer DEFAULT '0' NOT NULL,\n\
2367 lifetime varchar(255) DEFAULT '30d' NOT NULL,\n\
2368 snmpv3_authprotocol integer DEFAULT '0' NOT NULL,\n\
2369 snmpv3_privprotocol integer DEFAULT '0' NOT NULL,\n\
2370 state integer DEFAULT '0' NOT NULL,\n\
2371 snmpv3_contextname varchar(255) DEFAULT '' NOT NULL,\n\
2372 evaltype integer DEFAULT '0' NOT NULL,\n\
2373 jmx_endpoint varchar(255) DEFAULT '' NOT NULL,\n\
2374 master_itemid bigint  NULL REFERENCES items (itemid) ON DELETE CASCADE,\n\
2375 timeout varchar(255) DEFAULT '3s' NOT NULL,\n\
2376 url varchar(2048) DEFAULT '' NOT NULL,\n\
2377 query_fields varchar(2048) DEFAULT '' NOT NULL,\n\
2378 posts text DEFAULT '' NOT NULL,\n\
2379 status_codes varchar(255) DEFAULT '200' NOT NULL,\n\
2380 follow_redirects integer DEFAULT '1' NOT NULL,\n\
2381 post_type integer DEFAULT '0' NOT NULL,\n\
2382 http_proxy varchar(255) DEFAULT '' NOT NULL,\n\
2383 headers text DEFAULT '' NOT NULL,\n\
2384 retrieve_mode integer DEFAULT '0' NOT NULL,\n\
2385 request_method integer DEFAULT '0' NOT NULL,\n\
2386 output_format integer DEFAULT '0' NOT NULL,\n\
2387 ssl_cert_file varchar(255) DEFAULT '' NOT NULL,\n\
2388 ssl_key_file varchar(255) DEFAULT '' NOT NULL,\n\
2389 ssl_key_password varchar(64) DEFAULT '' NOT NULL,\n\
2390 verify_peer integer DEFAULT '0' NOT NULL,\n\
2391 verify_host integer DEFAULT '0' NOT NULL,\n\
2392 allow_traps integer DEFAULT '0' NOT NULL,\n\
2393 PRIMARY KEY (itemid)\n\
2394 );\n\
2395 CREATE UNIQUE INDEX items_1 ON items (hostid,key_);\n\
2396 CREATE INDEX items_3 ON items (status);\n\
2397 CREATE INDEX items_4 ON items (templateid);\n\
2398 CREATE INDEX items_5 ON items (valuemapid);\n\
2399 CREATE INDEX items_6 ON items (interfaceid);\n\
2400 CREATE INDEX items_7 ON items (master_itemid);\n\
2401 CREATE TABLE httpstepitem (\n\
2402 httpstepitemid bigint  NOT NULL,\n\
2403 httpstepid bigint  NOT NULL REFERENCES httpstep (httpstepid) ON DELETE CASCADE,\n\
2404 itemid bigint  NOT NULL REFERENCES items (itemid) ON DELETE CASCADE,\n\
2405 type integer DEFAULT '0' NOT NULL,\n\
2406 PRIMARY KEY (httpstepitemid)\n\
2407 );\n\
2408 CREATE UNIQUE INDEX httpstepitem_1 ON httpstepitem (httpstepid,itemid);\n\
2409 CREATE INDEX httpstepitem_2 ON httpstepitem (itemid);\n\
2410 CREATE TABLE httptestitem (\n\
2411 httptestitemid bigint  NOT NULL,\n\
2412 httptestid bigint  NOT NULL REFERENCES httptest (httptestid) ON DELETE CASCADE,\n\
2413 itemid bigint  NOT NULL REFERENCES items (itemid) ON DELETE CASCADE,\n\
2414 type integer DEFAULT '0' NOT NULL,\n\
2415 PRIMARY KEY (httptestitemid)\n\
2416 );\n\
2417 CREATE UNIQUE INDEX httptestitem_1 ON httptestitem (httptestid,itemid);\n\
2418 CREATE INDEX httptestitem_2 ON httptestitem (itemid);\n\
2419 CREATE TABLE media_type (\n\
2420 mediatypeid bigint  NOT NULL,\n\
2421 type integer DEFAULT '0' NOT NULL,\n\
2422 description varchar(100) DEFAULT '' NOT NULL,\n\
2423 smtp_server varchar(255) DEFAULT '' NOT NULL,\n\
2424 smtp_helo varchar(255) DEFAULT '' NOT NULL,\n\
2425 smtp_email varchar(255) DEFAULT '' NOT NULL,\n\
2426 exec_path varchar(255) DEFAULT '' NOT NULL,\n\
2427 gsm_modem varchar(255) DEFAULT '' NOT NULL,\n\
2428 username varchar(255) DEFAULT '' NOT NULL,\n\
2429 passwd varchar(255) DEFAULT '' NOT NULL,\n\
2430 status integer DEFAULT '0' NOT NULL,\n\
2431 smtp_port integer DEFAULT '25' NOT NULL,\n\
2432 smtp_security integer DEFAULT '0' NOT NULL,\n\
2433 smtp_verify_peer integer DEFAULT '0' NOT NULL,\n\
2434 smtp_verify_host integer DEFAULT '0' NOT NULL,\n\
2435 smtp_authentication integer DEFAULT '0' NOT NULL,\n\
2436 exec_params varchar(255) DEFAULT '' NOT NULL,\n\
2437 maxsessions integer DEFAULT '1' NOT NULL,\n\
2438 maxattempts integer DEFAULT '3' NOT NULL,\n\
2439 attempt_interval varchar(32) DEFAULT '10s' NOT NULL,\n\
2440 PRIMARY KEY (mediatypeid)\n\
2441 );\n\
2442 CREATE UNIQUE INDEX media_type_1 ON media_type (description);\n\
2443 CREATE TABLE usrgrp (\n\
2444 usrgrpid bigint  NOT NULL,\n\
2445 name varchar(64) DEFAULT '' NOT NULL,\n\
2446 gui_access integer DEFAULT '0' NOT NULL,\n\
2447 users_status integer DEFAULT '0' NOT NULL,\n\
2448 debug_mode integer DEFAULT '0' NOT NULL,\n\
2449 PRIMARY KEY (usrgrpid)\n\
2450 );\n\
2451 CREATE UNIQUE INDEX usrgrp_1 ON usrgrp (name);\n\
2452 CREATE TABLE users_groups (\n\
2453 id bigint  NOT NULL,\n\
2454 usrgrpid bigint  NOT NULL REFERENCES usrgrp (usrgrpid) ON DELETE CASCADE,\n\
2455 userid bigint  NOT NULL REFERENCES users (userid) ON DELETE CASCADE,\n\
2456 PRIMARY KEY (id)\n\
2457 );\n\
2458 CREATE UNIQUE INDEX users_groups_1 ON users_groups (usrgrpid,userid);\n\
2459 CREATE INDEX users_groups_2 ON users_groups (userid);\n\
2460 CREATE TABLE scripts (\n\
2461 scriptid bigint  NOT NULL,\n\
2462 name varchar(255) DEFAULT '' NOT NULL,\n\
2463 command varchar(255) DEFAULT '' NOT NULL,\n\
2464 host_access integer DEFAULT '2' NOT NULL,\n\
2465 usrgrpid bigint  NULL REFERENCES usrgrp (usrgrpid),\n\
2466 groupid bigint  NULL REFERENCES hstgrp (groupid),\n\
2467 description text DEFAULT '' NOT NULL,\n\
2468 confirmation varchar(255) DEFAULT '' NOT NULL,\n\
2469 type integer DEFAULT '0' NOT NULL,\n\
2470 execute_on integer DEFAULT '2' NOT NULL,\n\
2471 PRIMARY KEY (scriptid)\n\
2472 );\n\
2473 CREATE INDEX scripts_1 ON scripts (usrgrpid);\n\
2474 CREATE INDEX scripts_2 ON scripts (groupid);\n\
2475 CREATE UNIQUE INDEX scripts_3 ON scripts (name);\n\
2476 CREATE TABLE actions (\n\
2477 actionid bigint  NOT NULL,\n\
2478 name varchar(255) DEFAULT '' NOT NULL,\n\
2479 eventsource integer DEFAULT '0' NOT NULL,\n\
2480 evaltype integer DEFAULT '0' NOT NULL,\n\
2481 status integer DEFAULT '0' NOT NULL,\n\
2482 esc_period varchar(255) DEFAULT '1h' NOT NULL,\n\
2483 def_shortdata varchar(255) DEFAULT '' NOT NULL,\n\
2484 def_longdata text DEFAULT '' NOT NULL,\n\
2485 r_shortdata varchar(255) DEFAULT '' NOT NULL,\n\
2486 r_longdata text DEFAULT '' NOT NULL,\n\
2487 formula varchar(255) DEFAULT '' NOT NULL,\n\
2488 pause_suppressed integer DEFAULT '1' NOT NULL,\n\
2489 ack_shortdata varchar(255) DEFAULT '' NOT NULL,\n\
2490 ack_longdata text DEFAULT '' NOT NULL,\n\
2491 PRIMARY KEY (actionid)\n\
2492 );\n\
2493 CREATE INDEX actions_1 ON actions (eventsource,status);\n\
2494 CREATE UNIQUE INDEX actions_2 ON actions (name);\n\
2495 CREATE TABLE operations (\n\
2496 operationid bigint  NOT NULL,\n\
2497 actionid bigint  NOT NULL REFERENCES actions (actionid) ON DELETE CASCADE,\n\
2498 operationtype integer DEFAULT '0' NOT NULL,\n\
2499 esc_period varchar(255) DEFAULT '0' NOT NULL,\n\
2500 esc_step_from integer DEFAULT '1' NOT NULL,\n\
2501 esc_step_to integer DEFAULT '1' NOT NULL,\n\
2502 evaltype integer DEFAULT '0' NOT NULL,\n\
2503 recovery integer DEFAULT '0' NOT NULL,\n\
2504 PRIMARY KEY (operationid)\n\
2505 );\n\
2506 CREATE INDEX operations_1 ON operations (actionid);\n\
2507 CREATE TABLE opmessage (\n\
2508 operationid bigint  NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE,\n\
2509 default_msg integer DEFAULT '0' NOT NULL,\n\
2510 subject varchar(255) DEFAULT '' NOT NULL,\n\
2511 message text DEFAULT '' NOT NULL,\n\
2512 mediatypeid bigint  NULL REFERENCES media_type (mediatypeid),\n\
2513 PRIMARY KEY (operationid)\n\
2514 );\n\
2515 CREATE INDEX opmessage_1 ON opmessage (mediatypeid);\n\
2516 CREATE TABLE opmessage_grp (\n\
2517 opmessage_grpid bigint  NOT NULL,\n\
2518 operationid bigint  NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE,\n\
2519 usrgrpid bigint  NOT NULL REFERENCES usrgrp (usrgrpid),\n\
2520 PRIMARY KEY (opmessage_grpid)\n\
2521 );\n\
2522 CREATE UNIQUE INDEX opmessage_grp_1 ON opmessage_grp (operationid,usrgrpid);\n\
2523 CREATE INDEX opmessage_grp_2 ON opmessage_grp (usrgrpid);\n\
2524 CREATE TABLE opmessage_usr (\n\
2525 opmessage_usrid bigint  NOT NULL,\n\
2526 operationid bigint  NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE,\n\
2527 userid bigint  NOT NULL REFERENCES users (userid),\n\
2528 PRIMARY KEY (opmessage_usrid)\n\
2529 );\n\
2530 CREATE UNIQUE INDEX opmessage_usr_1 ON opmessage_usr (operationid,userid);\n\
2531 CREATE INDEX opmessage_usr_2 ON opmessage_usr (userid);\n\
2532 CREATE TABLE opcommand (\n\
2533 operationid bigint  NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE,\n\
2534 type integer DEFAULT '0' NOT NULL,\n\
2535 scriptid bigint  NULL REFERENCES scripts (scriptid),\n\
2536 execute_on integer DEFAULT '0' NOT NULL,\n\
2537 port varchar(64) DEFAULT '' NOT NULL,\n\
2538 authtype integer DEFAULT '0' NOT NULL,\n\
2539 username varchar(64) DEFAULT '' NOT NULL,\n\
2540 password varchar(64) DEFAULT '' NOT NULL,\n\
2541 publickey varchar(64) DEFAULT '' NOT NULL,\n\
2542 privatekey varchar(64) DEFAULT '' NOT NULL,\n\
2543 command text DEFAULT '' NOT NULL,\n\
2544 PRIMARY KEY (operationid)\n\
2545 );\n\
2546 CREATE INDEX opcommand_1 ON opcommand (scriptid);\n\
2547 CREATE TABLE opcommand_hst (\n\
2548 opcommand_hstid bigint  NOT NULL,\n\
2549 operationid bigint  NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE,\n\
2550 hostid bigint  NULL REFERENCES hosts (hostid),\n\
2551 PRIMARY KEY (opcommand_hstid)\n\
2552 );\n\
2553 CREATE INDEX opcommand_hst_1 ON opcommand_hst (operationid);\n\
2554 CREATE INDEX opcommand_hst_2 ON opcommand_hst (hostid);\n\
2555 CREATE TABLE opcommand_grp (\n\
2556 opcommand_grpid bigint  NOT NULL,\n\
2557 operationid bigint  NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE,\n\
2558 groupid bigint  NOT NULL REFERENCES hstgrp (groupid),\n\
2559 PRIMARY KEY (opcommand_grpid)\n\
2560 );\n\
2561 CREATE INDEX opcommand_grp_1 ON opcommand_grp (operationid);\n\
2562 CREATE INDEX opcommand_grp_2 ON opcommand_grp (groupid);\n\
2563 CREATE TABLE opgroup (\n\
2564 opgroupid bigint  NOT NULL,\n\
2565 operationid bigint  NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE,\n\
2566 groupid bigint  NOT NULL REFERENCES hstgrp (groupid),\n\
2567 PRIMARY KEY (opgroupid)\n\
2568 );\n\
2569 CREATE UNIQUE INDEX opgroup_1 ON opgroup (operationid,groupid);\n\
2570 CREATE INDEX opgroup_2 ON opgroup (groupid);\n\
2571 CREATE TABLE optemplate (\n\
2572 optemplateid bigint  NOT NULL,\n\
2573 operationid bigint  NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE,\n\
2574 templateid bigint  NOT NULL REFERENCES hosts (hostid),\n\
2575 PRIMARY KEY (optemplateid)\n\
2576 );\n\
2577 CREATE UNIQUE INDEX optemplate_1 ON optemplate (operationid,templateid);\n\
2578 CREATE INDEX optemplate_2 ON optemplate (templateid);\n\
2579 CREATE TABLE opconditions (\n\
2580 opconditionid bigint  NOT NULL,\n\
2581 operationid bigint  NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE,\n\
2582 conditiontype integer DEFAULT '0' NOT NULL,\n\
2583 operator integer DEFAULT '0' NOT NULL,\n\
2584 value varchar(255) DEFAULT '' NOT NULL,\n\
2585 PRIMARY KEY (opconditionid)\n\
2586 );\n\
2587 CREATE INDEX opconditions_1 ON opconditions (operationid);\n\
2588 CREATE TABLE conditions (\n\
2589 conditionid bigint  NOT NULL,\n\
2590 actionid bigint  NOT NULL REFERENCES actions (actionid) ON DELETE CASCADE,\n\
2591 conditiontype integer DEFAULT '0' NOT NULL,\n\
2592 operator integer DEFAULT '0' NOT NULL,\n\
2593 value varchar(255) DEFAULT '' NOT NULL,\n\
2594 value2 varchar(255) DEFAULT '' NOT NULL,\n\
2595 PRIMARY KEY (conditionid)\n\
2596 );\n\
2597 CREATE INDEX conditions_1 ON conditions (actionid);\n\
2598 CREATE TABLE config (\n\
2599 configid bigint  NOT NULL,\n\
2600 refresh_unsupported varchar(32) DEFAULT '10m' NOT NULL,\n\
2601 work_period varchar(255) DEFAULT '1-5,09:00-18:00' NOT NULL,\n\
2602 alert_usrgrpid bigint  NULL REFERENCES usrgrp (usrgrpid),\n\
2603 default_theme varchar(128) DEFAULT 'blue-theme' NOT NULL,\n\
2604 authentication_type integer DEFAULT '0' NOT NULL,\n\
2605 ldap_host varchar(255) DEFAULT '' NOT NULL,\n\
2606 ldap_port integer DEFAULT 389 NOT NULL,\n\
2607 ldap_base_dn varchar(255) DEFAULT '' NOT NULL,\n\
2608 ldap_bind_dn varchar(255) DEFAULT '' NOT NULL,\n\
2609 ldap_bind_password varchar(128) DEFAULT '' NOT NULL,\n\
2610 ldap_search_attribute varchar(128) DEFAULT '' NOT NULL,\n\
2611 dropdown_first_entry integer DEFAULT '1' NOT NULL,\n\
2612 dropdown_first_remember integer DEFAULT '1' NOT NULL,\n\
2613 discovery_groupid bigint  NOT NULL REFERENCES hstgrp (groupid),\n\
2614 max_in_table integer DEFAULT '50' NOT NULL,\n\
2615 search_limit integer DEFAULT '1000' NOT NULL,\n\
2616 severity_color_0 varchar(6) DEFAULT '97AAB3' NOT NULL,\n\
2617 severity_color_1 varchar(6) DEFAULT '7499FF' NOT NULL,\n\
2618 severity_color_2 varchar(6) DEFAULT 'FFC859' NOT NULL,\n\
2619 severity_color_3 varchar(6) DEFAULT 'FFA059' NOT NULL,\n\
2620 severity_color_4 varchar(6) DEFAULT 'E97659' NOT NULL,\n\
2621 severity_color_5 varchar(6) DEFAULT 'E45959' NOT NULL,\n\
2622 severity_name_0 varchar(32) DEFAULT 'Not classified' NOT NULL,\n\
2623 severity_name_1 varchar(32) DEFAULT 'Information' NOT NULL,\n\
2624 severity_name_2 varchar(32) DEFAULT 'Warning' NOT NULL,\n\
2625 severity_name_3 varchar(32) DEFAULT 'Average' NOT NULL,\n\
2626 severity_name_4 varchar(32) DEFAULT 'High' NOT NULL,\n\
2627 severity_name_5 varchar(32) DEFAULT 'Disaster' NOT NULL,\n\
2628 ok_period varchar(32) DEFAULT '5m' NOT NULL,\n\
2629 blink_period varchar(32) DEFAULT '2m' NOT NULL,\n\
2630 problem_unack_color varchar(6) DEFAULT 'CC0000' NOT NULL,\n\
2631 problem_ack_color varchar(6) DEFAULT 'CC0000' NOT NULL,\n\
2632 ok_unack_color varchar(6) DEFAULT '009900' NOT NULL,\n\
2633 ok_ack_color varchar(6) DEFAULT '009900' NOT NULL,\n\
2634 problem_unack_style integer DEFAULT '1' NOT NULL,\n\
2635 problem_ack_style integer DEFAULT '1' NOT NULL,\n\
2636 ok_unack_style integer DEFAULT '1' NOT NULL,\n\
2637 ok_ack_style integer DEFAULT '1' NOT NULL,\n\
2638 snmptrap_logging integer DEFAULT '1' NOT NULL,\n\
2639 server_check_interval integer DEFAULT '10' NOT NULL,\n\
2640 hk_events_mode integer DEFAULT '1' NOT NULL,\n\
2641 hk_events_trigger varchar(32) DEFAULT '365d' NOT NULL,\n\
2642 hk_events_internal varchar(32) DEFAULT '1d' NOT NULL,\n\
2643 hk_events_discovery varchar(32) DEFAULT '1d' NOT NULL,\n\
2644 hk_events_autoreg varchar(32) DEFAULT '1d' NOT NULL,\n\
2645 hk_services_mode integer DEFAULT '1' NOT NULL,\n\
2646 hk_services varchar(32) DEFAULT '365d' NOT NULL,\n\
2647 hk_audit_mode integer DEFAULT '1' NOT NULL,\n\
2648 hk_audit varchar(32) DEFAULT '365d' NOT NULL,\n\
2649 hk_sessions_mode integer DEFAULT '1' NOT NULL,\n\
2650 hk_sessions varchar(32) DEFAULT '365d' NOT NULL,\n\
2651 hk_history_mode integer DEFAULT '1' NOT NULL,\n\
2652 hk_history_global integer DEFAULT '0' NOT NULL,\n\
2653 hk_history varchar(32) DEFAULT '90d' NOT NULL,\n\
2654 hk_trends_mode integer DEFAULT '1' NOT NULL,\n\
2655 hk_trends_global integer DEFAULT '0' NOT NULL,\n\
2656 hk_trends varchar(32) DEFAULT '365d' NOT NULL,\n\
2657 default_inventory_mode integer DEFAULT '-1' NOT NULL,\n\
2658 custom_color integer DEFAULT '0' NOT NULL,\n\
2659 http_auth_enabled integer DEFAULT '0' NOT NULL,\n\
2660 http_login_form integer DEFAULT '0' NOT NULL,\n\
2661 http_strip_domains varchar(2048) DEFAULT '' NOT NULL,\n\
2662 http_case_sensitive integer DEFAULT '1' NOT NULL,\n\
2663 ldap_configured integer DEFAULT '0' NOT NULL,\n\
2664 ldap_case_sensitive integer DEFAULT '1' NOT NULL,\n\
2665 PRIMARY KEY (configid)\n\
2666 );\n\
2667 CREATE INDEX config_1 ON config (alert_usrgrpid);\n\
2668 CREATE INDEX config_2 ON config (discovery_groupid);\n\
2669 CREATE TABLE triggers (\n\
2670 triggerid bigint  NOT NULL,\n\
2671 expression varchar(2048) DEFAULT '' NOT NULL,\n\
2672 description varchar(255) DEFAULT '' NOT NULL,\n\
2673 url varchar(255) DEFAULT '' NOT NULL,\n\
2674 status integer DEFAULT '0' NOT NULL,\n\
2675 value integer DEFAULT '0' NOT NULL,\n\
2676 priority integer DEFAULT '0' NOT NULL,\n\
2677 lastchange integer DEFAULT '0' NOT NULL,\n\
2678 comments text DEFAULT '' NOT NULL,\n\
2679 error varchar(2048) DEFAULT '' NOT NULL,\n\
2680 templateid bigint  NULL REFERENCES triggers (triggerid) ON DELETE CASCADE,\n\
2681 type integer DEFAULT '0' NOT NULL,\n\
2682 state integer DEFAULT '0' NOT NULL,\n\
2683 flags integer DEFAULT '0' NOT NULL,\n\
2684 recovery_mode integer DEFAULT '0' NOT NULL,\n\
2685 recovery_expression varchar(2048) DEFAULT '' NOT NULL,\n\
2686 correlation_mode integer DEFAULT '0' NOT NULL,\n\
2687 correlation_tag varchar(255) DEFAULT '' NOT NULL,\n\
2688 manual_close integer DEFAULT '0' NOT NULL,\n\
2689 PRIMARY KEY (triggerid)\n\
2690 );\n\
2691 CREATE INDEX triggers_1 ON triggers (status);\n\
2692 CREATE INDEX triggers_2 ON triggers (value,lastchange);\n\
2693 CREATE INDEX triggers_3 ON triggers (templateid);\n\
2694 CREATE TABLE trigger_depends (\n\
2695 triggerdepid bigint  NOT NULL,\n\
2696 triggerid_down bigint  NOT NULL REFERENCES triggers (triggerid) ON DELETE CASCADE,\n\
2697 triggerid_up bigint  NOT NULL REFERENCES triggers (triggerid) ON DELETE CASCADE,\n\
2698 PRIMARY KEY (triggerdepid)\n\
2699 );\n\
2700 CREATE UNIQUE INDEX trigger_depends_1 ON trigger_depends (triggerid_down,triggerid_up);\n\
2701 CREATE INDEX trigger_depends_2 ON trigger_depends (triggerid_up);\n\
2702 CREATE TABLE functions (\n\
2703 functionid bigint  NOT NULL,\n\
2704 itemid bigint  NOT NULL REFERENCES items (itemid) ON DELETE CASCADE,\n\
2705 triggerid bigint  NOT NULL REFERENCES triggers (triggerid) ON DELETE CASCADE,\n\
2706 name varchar(12) DEFAULT '' NOT NULL,\n\
2707 parameter varchar(255) DEFAULT '0' NOT NULL,\n\
2708 PRIMARY KEY (functionid)\n\
2709 );\n\
2710 CREATE INDEX functions_1 ON functions (triggerid);\n\
2711 CREATE INDEX functions_2 ON functions (itemid,name,parameter);\n\
2712 CREATE TABLE graphs (\n\
2713 graphid bigint  NOT NULL,\n\
2714 name varchar(128) DEFAULT '' NOT NULL,\n\
2715 width integer DEFAULT '900' NOT NULL,\n\
2716 height integer DEFAULT '200' NOT NULL,\n\
2717 yaxismin double(16,4) DEFAULT '0' NOT NULL,\n\
2718 yaxismax double(16,4) DEFAULT '100' NOT NULL,\n\
2719 templateid bigint  NULL REFERENCES graphs (graphid) ON DELETE CASCADE,\n\
2720 show_work_period integer DEFAULT '1' NOT NULL,\n\
2721 show_triggers integer DEFAULT '1' NOT NULL,\n\
2722 graphtype integer DEFAULT '0' NOT NULL,\n\
2723 show_legend integer DEFAULT '1' NOT NULL,\n\
2724 show_3d integer DEFAULT '0' NOT NULL,\n\
2725 percent_left double(16,4) DEFAULT '0' NOT NULL,\n\
2726 percent_right double(16,4) DEFAULT '0' NOT NULL,\n\
2727 ymin_type integer DEFAULT '0' NOT NULL,\n\
2728 ymax_type integer DEFAULT '0' NOT NULL,\n\
2729 ymin_itemid bigint  NULL REFERENCES items (itemid),\n\
2730 ymax_itemid bigint  NULL REFERENCES items (itemid),\n\
2731 flags integer DEFAULT '0' NOT NULL,\n\
2732 PRIMARY KEY (graphid)\n\
2733 );\n\
2734 CREATE INDEX graphs_1 ON graphs (name);\n\
2735 CREATE INDEX graphs_2 ON graphs (templateid);\n\
2736 CREATE INDEX graphs_3 ON graphs (ymin_itemid);\n\
2737 CREATE INDEX graphs_4 ON graphs (ymax_itemid);\n\
2738 CREATE TABLE graphs_items (\n\
2739 gitemid bigint  NOT NULL,\n\
2740 graphid bigint  NOT NULL REFERENCES graphs (graphid) ON DELETE CASCADE,\n\
2741 itemid bigint  NOT NULL REFERENCES items (itemid) ON DELETE CASCADE,\n\
2742 drawtype integer DEFAULT '0' NOT NULL,\n\
2743 sortorder integer DEFAULT '0' NOT NULL,\n\
2744 color varchar(6) DEFAULT '009600' NOT NULL,\n\
2745 yaxisside integer DEFAULT '0' NOT NULL,\n\
2746 calc_fnc integer DEFAULT '2' NOT NULL,\n\
2747 type integer DEFAULT '0' NOT NULL,\n\
2748 PRIMARY KEY (gitemid)\n\
2749 );\n\
2750 CREATE INDEX graphs_items_1 ON graphs_items (itemid);\n\
2751 CREATE INDEX graphs_items_2 ON graphs_items (graphid);\n\
2752 CREATE TABLE graph_theme (\n\
2753 graphthemeid bigint  NOT NULL,\n\
2754 theme varchar(64) DEFAULT '' NOT NULL,\n\
2755 backgroundcolor varchar(6) DEFAULT '' NOT NULL,\n\
2756 graphcolor varchar(6) DEFAULT '' NOT NULL,\n\
2757 gridcolor varchar(6) DEFAULT '' NOT NULL,\n\
2758 maingridcolor varchar(6) DEFAULT '' NOT NULL,\n\
2759 gridbordercolor varchar(6) DEFAULT '' NOT NULL,\n\
2760 textcolor varchar(6) DEFAULT '' NOT NULL,\n\
2761 highlightcolor varchar(6) DEFAULT '' NOT NULL,\n\
2762 leftpercentilecolor varchar(6) DEFAULT '' NOT NULL,\n\
2763 rightpercentilecolor varchar(6) DEFAULT '' NOT NULL,\n\
2764 nonworktimecolor varchar(6) DEFAULT '' NOT NULL,\n\
2765 colorpalette varchar(255) DEFAULT '' NOT NULL,\n\
2766 PRIMARY KEY (graphthemeid)\n\
2767 );\n\
2768 CREATE UNIQUE INDEX graph_theme_1 ON graph_theme (theme);\n\
2769 CREATE TABLE globalmacro (\n\
2770 globalmacroid bigint  NOT NULL,\n\
2771 macro varchar(255) DEFAULT '' NOT NULL,\n\
2772 value varchar(255) DEFAULT '' NOT NULL,\n\
2773 PRIMARY KEY (globalmacroid)\n\
2774 );\n\
2775 CREATE UNIQUE INDEX globalmacro_1 ON globalmacro (macro);\n\
2776 CREATE TABLE hostmacro (\n\
2777 hostmacroid bigint  NOT NULL,\n\
2778 hostid bigint  NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
2779 macro varchar(255) DEFAULT '' NOT NULL,\n\
2780 value varchar(255) DEFAULT '' NOT NULL,\n\
2781 PRIMARY KEY (hostmacroid)\n\
2782 );\n\
2783 CREATE UNIQUE INDEX hostmacro_1 ON hostmacro (hostid,macro);\n\
2784 CREATE TABLE hosts_groups (\n\
2785 hostgroupid bigint  NOT NULL,\n\
2786 hostid bigint  NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
2787 groupid bigint  NOT NULL REFERENCES hstgrp (groupid) ON DELETE CASCADE,\n\
2788 PRIMARY KEY (hostgroupid)\n\
2789 );\n\
2790 CREATE UNIQUE INDEX hosts_groups_1 ON hosts_groups (hostid,groupid);\n\
2791 CREATE INDEX hosts_groups_2 ON hosts_groups (groupid);\n\
2792 CREATE TABLE hosts_templates (\n\
2793 hosttemplateid bigint  NOT NULL,\n\
2794 hostid bigint  NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
2795 templateid bigint  NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
2796 PRIMARY KEY (hosttemplateid)\n\
2797 );\n\
2798 CREATE UNIQUE INDEX hosts_templates_1 ON hosts_templates (hostid,templateid);\n\
2799 CREATE INDEX hosts_templates_2 ON hosts_templates (templateid);\n\
2800 CREATE TABLE items_applications (\n\
2801 itemappid bigint  NOT NULL,\n\
2802 applicationid bigint  NOT NULL REFERENCES applications (applicationid) ON DELETE CASCADE,\n\
2803 itemid bigint  NOT NULL REFERENCES items (itemid) ON DELETE CASCADE,\n\
2804 PRIMARY KEY (itemappid)\n\
2805 );\n\
2806 CREATE UNIQUE INDEX items_applications_1 ON items_applications (applicationid,itemid);\n\
2807 CREATE INDEX items_applications_2 ON items_applications (itemid);\n\
2808 CREATE TABLE mappings (\n\
2809 mappingid bigint  NOT NULL,\n\
2810 valuemapid bigint  NOT NULL REFERENCES valuemaps (valuemapid) ON DELETE CASCADE,\n\
2811 value varchar(64) DEFAULT '' NOT NULL,\n\
2812 newvalue varchar(64) DEFAULT '' NOT NULL,\n\
2813 PRIMARY KEY (mappingid)\n\
2814 );\n\
2815 CREATE INDEX mappings_1 ON mappings (valuemapid);\n\
2816 CREATE TABLE media (\n\
2817 mediaid bigint  NOT NULL,\n\
2818 userid bigint  NOT NULL REFERENCES users (userid) ON DELETE CASCADE,\n\
2819 mediatypeid bigint  NOT NULL REFERENCES media_type (mediatypeid) ON DELETE CASCADE,\n\
2820 sendto varchar(1024) DEFAULT '' NOT NULL,\n\
2821 active integer DEFAULT '0' NOT NULL,\n\
2822 severity integer DEFAULT '63' NOT NULL,\n\
2823 period varchar(1024) DEFAULT '1-7,00:00-24:00' NOT NULL,\n\
2824 PRIMARY KEY (mediaid)\n\
2825 );\n\
2826 CREATE INDEX media_1 ON media (userid);\n\
2827 CREATE INDEX media_2 ON media (mediatypeid);\n\
2828 CREATE TABLE rights (\n\
2829 rightid bigint  NOT NULL,\n\
2830 groupid bigint  NOT NULL REFERENCES usrgrp (usrgrpid) ON DELETE CASCADE,\n\
2831 permission integer DEFAULT '0' NOT NULL,\n\
2832 id bigint  NOT NULL REFERENCES hstgrp (groupid) ON DELETE CASCADE,\n\
2833 PRIMARY KEY (rightid)\n\
2834 );\n\
2835 CREATE INDEX rights_1 ON rights (groupid);\n\
2836 CREATE INDEX rights_2 ON rights (id);\n\
2837 CREATE TABLE services (\n\
2838 serviceid bigint  NOT NULL,\n\
2839 name varchar(128) DEFAULT '' NOT NULL,\n\
2840 status integer DEFAULT '0' NOT NULL,\n\
2841 algorithm integer DEFAULT '0' NOT NULL,\n\
2842 triggerid bigint  NULL REFERENCES triggers (triggerid) ON DELETE CASCADE,\n\
2843 showsla integer DEFAULT '0' NOT NULL,\n\
2844 goodsla double(16,4) DEFAULT '99.9' NOT NULL,\n\
2845 sortorder integer DEFAULT '0' NOT NULL,\n\
2846 PRIMARY KEY (serviceid)\n\
2847 );\n\
2848 CREATE INDEX services_1 ON services (triggerid);\n\
2849 CREATE TABLE services_links (\n\
2850 linkid bigint  NOT NULL,\n\
2851 serviceupid bigint  NOT NULL REFERENCES services (serviceid) ON DELETE CASCADE,\n\
2852 servicedownid bigint  NOT NULL REFERENCES services (serviceid) ON DELETE CASCADE,\n\
2853 soft integer DEFAULT '0' NOT NULL,\n\
2854 PRIMARY KEY (linkid)\n\
2855 );\n\
2856 CREATE INDEX services_links_1 ON services_links (servicedownid);\n\
2857 CREATE UNIQUE INDEX services_links_2 ON services_links (serviceupid,servicedownid);\n\
2858 CREATE TABLE services_times (\n\
2859 timeid bigint  NOT NULL,\n\
2860 serviceid bigint  NOT NULL REFERENCES services (serviceid) ON DELETE CASCADE,\n\
2861 type integer DEFAULT '0' NOT NULL,\n\
2862 ts_from integer DEFAULT '0' NOT NULL,\n\
2863 ts_to integer DEFAULT '0' NOT NULL,\n\
2864 note varchar(255) DEFAULT '' NOT NULL,\n\
2865 PRIMARY KEY (timeid)\n\
2866 );\n\
2867 CREATE INDEX services_times_1 ON services_times (serviceid,type,ts_from,ts_to);\n\
2868 CREATE TABLE icon_map (\n\
2869 iconmapid bigint  NOT NULL,\n\
2870 name varchar(64) DEFAULT '' NOT NULL,\n\
2871 default_iconid bigint  NOT NULL REFERENCES images (imageid),\n\
2872 PRIMARY KEY (iconmapid)\n\
2873 );\n\
2874 CREATE UNIQUE INDEX icon_map_1 ON icon_map (name);\n\
2875 CREATE INDEX icon_map_2 ON icon_map (default_iconid);\n\
2876 CREATE TABLE icon_mapping (\n\
2877 iconmappingid bigint  NOT NULL,\n\
2878 iconmapid bigint  NOT NULL REFERENCES icon_map (iconmapid) ON DELETE CASCADE,\n\
2879 iconid bigint  NOT NULL REFERENCES images (imageid),\n\
2880 inventory_link integer DEFAULT '0' NOT NULL,\n\
2881 expression varchar(64) DEFAULT '' NOT NULL,\n\
2882 sortorder integer DEFAULT '0' NOT NULL,\n\
2883 PRIMARY KEY (iconmappingid)\n\
2884 );\n\
2885 CREATE INDEX icon_mapping_1 ON icon_mapping (iconmapid);\n\
2886 CREATE INDEX icon_mapping_2 ON icon_mapping (iconid);\n\
2887 CREATE TABLE sysmaps (\n\
2888 sysmapid bigint  NOT NULL,\n\
2889 name varchar(128) DEFAULT '' NOT NULL,\n\
2890 width integer DEFAULT '600' NOT NULL,\n\
2891 height integer DEFAULT '400' NOT NULL,\n\
2892 backgroundid bigint  NULL REFERENCES images (imageid),\n\
2893 label_type integer DEFAULT '2' NOT NULL,\n\
2894 label_location integer DEFAULT '0' NOT NULL,\n\
2895 highlight integer DEFAULT '1' NOT NULL,\n\
2896 expandproblem integer DEFAULT '1' NOT NULL,\n\
2897 markelements integer DEFAULT '0' NOT NULL,\n\
2898 show_unack integer DEFAULT '0' NOT NULL,\n\
2899 grid_size integer DEFAULT '50' NOT NULL,\n\
2900 grid_show integer DEFAULT '1' NOT NULL,\n\
2901 grid_align integer DEFAULT '1' NOT NULL,\n\
2902 label_format integer DEFAULT '0' NOT NULL,\n\
2903 label_type_host integer DEFAULT '2' NOT NULL,\n\
2904 label_type_hostgroup integer DEFAULT '2' NOT NULL,\n\
2905 label_type_trigger integer DEFAULT '2' NOT NULL,\n\
2906 label_type_map integer DEFAULT '2' NOT NULL,\n\
2907 label_type_image integer DEFAULT '2' NOT NULL,\n\
2908 label_string_host varchar(255) DEFAULT '' NOT NULL,\n\
2909 label_string_hostgroup varchar(255) DEFAULT '' NOT NULL,\n\
2910 label_string_trigger varchar(255) DEFAULT '' NOT NULL,\n\
2911 label_string_map varchar(255) DEFAULT '' NOT NULL,\n\
2912 label_string_image varchar(255) DEFAULT '' NOT NULL,\n\
2913 iconmapid bigint  NULL REFERENCES icon_map (iconmapid),\n\
2914 expand_macros integer DEFAULT '0' NOT NULL,\n\
2915 severity_min integer DEFAULT '0' NOT NULL,\n\
2916 userid bigint  NOT NULL REFERENCES users (userid),\n\
2917 private integer DEFAULT '1' NOT NULL,\n\
2918 show_suppressed integer DEFAULT '0' NOT NULL,\n\
2919 PRIMARY KEY (sysmapid)\n\
2920 );\n\
2921 CREATE UNIQUE INDEX sysmaps_1 ON sysmaps (name);\n\
2922 CREATE INDEX sysmaps_2 ON sysmaps (backgroundid);\n\
2923 CREATE INDEX sysmaps_3 ON sysmaps (iconmapid);\n\
2924 CREATE TABLE sysmaps_elements (\n\
2925 selementid bigint  NOT NULL,\n\
2926 sysmapid bigint  NOT NULL REFERENCES sysmaps (sysmapid) ON DELETE CASCADE,\n\
2927 elementid bigint DEFAULT '0' NOT NULL,\n\
2928 elementtype integer DEFAULT '0' NOT NULL,\n\
2929 iconid_off bigint  NULL REFERENCES images (imageid),\n\
2930 iconid_on bigint  NULL REFERENCES images (imageid),\n\
2931 label varchar(2048) DEFAULT '' NOT NULL,\n\
2932 label_location integer DEFAULT '-1' NOT NULL,\n\
2933 x integer DEFAULT '0' NOT NULL,\n\
2934 y integer DEFAULT '0' NOT NULL,\n\
2935 iconid_disabled bigint  NULL REFERENCES images (imageid),\n\
2936 iconid_maintenance bigint  NULL REFERENCES images (imageid),\n\
2937 elementsubtype integer DEFAULT '0' NOT NULL,\n\
2938 areatype integer DEFAULT '0' NOT NULL,\n\
2939 width integer DEFAULT '200' NOT NULL,\n\
2940 height integer DEFAULT '200' NOT NULL,\n\
2941 viewtype integer DEFAULT '0' NOT NULL,\n\
2942 use_iconmap integer DEFAULT '1' NOT NULL,\n\
2943 application varchar(255) DEFAULT '' NOT NULL,\n\
2944 PRIMARY KEY (selementid)\n\
2945 );\n\
2946 CREATE INDEX sysmaps_elements_1 ON sysmaps_elements (sysmapid);\n\
2947 CREATE INDEX sysmaps_elements_2 ON sysmaps_elements (iconid_off);\n\
2948 CREATE INDEX sysmaps_elements_3 ON sysmaps_elements (iconid_on);\n\
2949 CREATE INDEX sysmaps_elements_4 ON sysmaps_elements (iconid_disabled);\n\
2950 CREATE INDEX sysmaps_elements_5 ON sysmaps_elements (iconid_maintenance);\n\
2951 CREATE TABLE sysmaps_links (\n\
2952 linkid bigint  NOT NULL,\n\
2953 sysmapid bigint  NOT NULL REFERENCES sysmaps (sysmapid) ON DELETE CASCADE,\n\
2954 selementid1 bigint  NOT NULL REFERENCES sysmaps_elements (selementid) ON DELETE CASCADE,\n\
2955 selementid2 bigint  NOT NULL REFERENCES sysmaps_elements (selementid) ON DELETE CASCADE,\n\
2956 drawtype integer DEFAULT '0' NOT NULL,\n\
2957 color varchar(6) DEFAULT '000000' NOT NULL,\n\
2958 label varchar(2048) DEFAULT '' NOT NULL,\n\
2959 PRIMARY KEY (linkid)\n\
2960 );\n\
2961 CREATE INDEX sysmaps_links_1 ON sysmaps_links (sysmapid);\n\
2962 CREATE INDEX sysmaps_links_2 ON sysmaps_links (selementid1);\n\
2963 CREATE INDEX sysmaps_links_3 ON sysmaps_links (selementid2);\n\
2964 CREATE TABLE sysmaps_link_triggers (\n\
2965 linktriggerid bigint  NOT NULL,\n\
2966 linkid bigint  NOT NULL REFERENCES sysmaps_links (linkid) ON DELETE CASCADE,\n\
2967 triggerid bigint  NOT NULL REFERENCES triggers (triggerid) ON DELETE CASCADE,\n\
2968 drawtype integer DEFAULT '0' NOT NULL,\n\
2969 color varchar(6) DEFAULT '000000' NOT NULL,\n\
2970 PRIMARY KEY (linktriggerid)\n\
2971 );\n\
2972 CREATE UNIQUE INDEX sysmaps_link_triggers_1 ON sysmaps_link_triggers (linkid,triggerid);\n\
2973 CREATE INDEX sysmaps_link_triggers_2 ON sysmaps_link_triggers (triggerid);\n\
2974 CREATE TABLE sysmap_element_url (\n\
2975 sysmapelementurlid bigint  NOT NULL,\n\
2976 selementid bigint  NOT NULL REFERENCES sysmaps_elements (selementid) ON DELETE CASCADE,\n\
2977 name varchar(255)  NOT NULL,\n\
2978 url varchar(255) DEFAULT '' NOT NULL,\n\
2979 PRIMARY KEY (sysmapelementurlid)\n\
2980 );\n\
2981 CREATE UNIQUE INDEX sysmap_element_url_1 ON sysmap_element_url (selementid,name);\n\
2982 CREATE TABLE sysmap_url (\n\
2983 sysmapurlid bigint  NOT NULL,\n\
2984 sysmapid bigint  NOT NULL REFERENCES sysmaps (sysmapid) ON DELETE CASCADE,\n\
2985 name varchar(255)  NOT NULL,\n\
2986 url varchar(255) DEFAULT '' NOT NULL,\n\
2987 elementtype integer DEFAULT '0' NOT NULL,\n\
2988 PRIMARY KEY (sysmapurlid)\n\
2989 );\n\
2990 CREATE UNIQUE INDEX sysmap_url_1 ON sysmap_url (sysmapid,name);\n\
2991 CREATE TABLE sysmap_user (\n\
2992 sysmapuserid bigint  NOT NULL,\n\
2993 sysmapid bigint  NOT NULL REFERENCES sysmaps (sysmapid) ON DELETE CASCADE,\n\
2994 userid bigint  NOT NULL REFERENCES users (userid) ON DELETE CASCADE,\n\
2995 permission integer DEFAULT '2' NOT NULL,\n\
2996 PRIMARY KEY (sysmapuserid)\n\
2997 );\n\
2998 CREATE UNIQUE INDEX sysmap_user_1 ON sysmap_user (sysmapid,userid);\n\
2999 CREATE TABLE sysmap_usrgrp (\n\
3000 sysmapusrgrpid bigint  NOT NULL,\n\
3001 sysmapid bigint  NOT NULL REFERENCES sysmaps (sysmapid) ON DELETE CASCADE,\n\
3002 usrgrpid bigint  NOT NULL REFERENCES usrgrp (usrgrpid) ON DELETE CASCADE,\n\
3003 permission integer DEFAULT '2' NOT NULL,\n\
3004 PRIMARY KEY (sysmapusrgrpid)\n\
3005 );\n\
3006 CREATE UNIQUE INDEX sysmap_usrgrp_1 ON sysmap_usrgrp (sysmapid,usrgrpid);\n\
3007 CREATE TABLE maintenances_hosts (\n\
3008 maintenance_hostid bigint  NOT NULL,\n\
3009 maintenanceid bigint  NOT NULL REFERENCES maintenances (maintenanceid) ON DELETE CASCADE,\n\
3010 hostid bigint  NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
3011 PRIMARY KEY (maintenance_hostid)\n\
3012 );\n\
3013 CREATE UNIQUE INDEX maintenances_hosts_1 ON maintenances_hosts (maintenanceid,hostid);\n\
3014 CREATE INDEX maintenances_hosts_2 ON maintenances_hosts (hostid);\n\
3015 CREATE TABLE maintenances_groups (\n\
3016 maintenance_groupid bigint  NOT NULL,\n\
3017 maintenanceid bigint  NOT NULL REFERENCES maintenances (maintenanceid) ON DELETE CASCADE,\n\
3018 groupid bigint  NOT NULL REFERENCES hstgrp (groupid) ON DELETE CASCADE,\n\
3019 PRIMARY KEY (maintenance_groupid)\n\
3020 );\n\
3021 CREATE UNIQUE INDEX maintenances_groups_1 ON maintenances_groups (maintenanceid,groupid);\n\
3022 CREATE INDEX maintenances_groups_2 ON maintenances_groups (groupid);\n\
3023 CREATE TABLE timeperiods (\n\
3024 timeperiodid bigint  NOT NULL,\n\
3025 timeperiod_type integer DEFAULT '0' NOT NULL,\n\
3026 every integer DEFAULT '1' NOT NULL,\n\
3027 month integer DEFAULT '0' NOT NULL,\n\
3028 dayofweek integer DEFAULT '0' NOT NULL,\n\
3029 day integer DEFAULT '0' NOT NULL,\n\
3030 start_time integer DEFAULT '0' NOT NULL,\n\
3031 period integer DEFAULT '0' NOT NULL,\n\
3032 start_date integer DEFAULT '0' NOT NULL,\n\
3033 PRIMARY KEY (timeperiodid)\n\
3034 );\n\
3035 CREATE TABLE maintenances_windows (\n\
3036 maintenance_timeperiodid bigint  NOT NULL,\n\
3037 maintenanceid bigint  NOT NULL REFERENCES maintenances (maintenanceid) ON DELETE CASCADE,\n\
3038 timeperiodid bigint  NOT NULL REFERENCES timeperiods (timeperiodid) ON DELETE CASCADE,\n\
3039 PRIMARY KEY (maintenance_timeperiodid)\n\
3040 );\n\
3041 CREATE UNIQUE INDEX maintenances_windows_1 ON maintenances_windows (maintenanceid,timeperiodid);\n\
3042 CREATE INDEX maintenances_windows_2 ON maintenances_windows (timeperiodid);\n\
3043 CREATE TABLE regexps (\n\
3044 regexpid bigint  NOT NULL,\n\
3045 name varchar(128) DEFAULT '' NOT NULL,\n\
3046 test_string text DEFAULT '' NOT NULL,\n\
3047 PRIMARY KEY (regexpid)\n\
3048 );\n\
3049 CREATE UNIQUE INDEX regexps_1 ON regexps (name);\n\
3050 CREATE TABLE expressions (\n\
3051 expressionid bigint  NOT NULL,\n\
3052 regexpid bigint  NOT NULL REFERENCES regexps (regexpid) ON DELETE CASCADE,\n\
3053 expression varchar(255) DEFAULT '' NOT NULL,\n\
3054 expression_type integer DEFAULT '0' NOT NULL,\n\
3055 exp_delimiter varchar(1) DEFAULT '' NOT NULL,\n\
3056 case_sensitive integer DEFAULT '0' NOT NULL,\n\
3057 PRIMARY KEY (expressionid)\n\
3058 );\n\
3059 CREATE INDEX expressions_1 ON expressions (regexpid);\n\
3060 CREATE TABLE ids (\n\
3061 table_name varchar(64) DEFAULT '' NOT NULL,\n\
3062 field_name varchar(64) DEFAULT '' NOT NULL,\n\
3063 nextid bigint  NOT NULL,\n\
3064 PRIMARY KEY (table_name,field_name)\n\
3065 );\n\
3066 CREATE TABLE alerts (\n\
3067 alertid bigint  NOT NULL,\n\
3068 actionid bigint  NOT NULL REFERENCES actions (actionid) ON DELETE CASCADE,\n\
3069 eventid bigint  NOT NULL REFERENCES events (eventid) ON DELETE CASCADE,\n\
3070 userid bigint  NULL REFERENCES users (userid) ON DELETE CASCADE,\n\
3071 clock integer DEFAULT '0' NOT NULL,\n\
3072 mediatypeid bigint  NULL REFERENCES media_type (mediatypeid) ON DELETE CASCADE,\n\
3073 sendto varchar(1024) DEFAULT '' NOT NULL,\n\
3074 subject varchar(255) DEFAULT '' NOT NULL,\n\
3075 message text DEFAULT '' NOT NULL,\n\
3076 status integer DEFAULT '0' NOT NULL,\n\
3077 retries integer DEFAULT '0' NOT NULL,\n\
3078 error varchar(2048) DEFAULT '' NOT NULL,\n\
3079 esc_step integer DEFAULT '0' NOT NULL,\n\
3080 alerttype integer DEFAULT '0' NOT NULL,\n\
3081 p_eventid bigint  NULL REFERENCES events (eventid) ON DELETE CASCADE,\n\
3082 acknowledgeid bigint  NULL REFERENCES acknowledges (acknowledgeid) ON DELETE CASCADE,\n\
3083 PRIMARY KEY (alertid)\n\
3084 );\n\
3085 CREATE INDEX alerts_1 ON alerts (actionid);\n\
3086 CREATE INDEX alerts_2 ON alerts (clock);\n\
3087 CREATE INDEX alerts_3 ON alerts (eventid);\n\
3088 CREATE INDEX alerts_4 ON alerts (status);\n\
3089 CREATE INDEX alerts_5 ON alerts (mediatypeid);\n\
3090 CREATE INDEX alerts_6 ON alerts (userid);\n\
3091 CREATE INDEX alerts_7 ON alerts (p_eventid);\n\
3092 CREATE TABLE history (\n\
3093 itemid bigint  NOT NULL,\n\
3094 clock integer DEFAULT '0' NOT NULL,\n\
3095 value double(16,4) DEFAULT '0.0000' NOT NULL,\n\
3096 ns integer DEFAULT '0' NOT NULL\n\
3097 );\n\
3098 CREATE INDEX history_1 ON history (itemid,clock);\n\
3099 CREATE TABLE history_uint (\n\
3100 itemid bigint  NOT NULL,\n\
3101 clock integer DEFAULT '0' NOT NULL,\n\
3102 value bigint DEFAULT '0' NOT NULL,\n\
3103 ns integer DEFAULT '0' NOT NULL\n\
3104 );\n\
3105 CREATE INDEX history_uint_1 ON history_uint (itemid,clock);\n\
3106 CREATE TABLE history_str (\n\
3107 itemid bigint  NOT NULL,\n\
3108 clock integer DEFAULT '0' NOT NULL,\n\
3109 value varchar(255) DEFAULT '' NOT NULL,\n\
3110 ns integer DEFAULT '0' NOT NULL\n\
3111 );\n\
3112 CREATE INDEX history_str_1 ON history_str (itemid,clock);\n\
3113 CREATE TABLE history_log (\n\
3114 itemid bigint  NOT NULL,\n\
3115 clock integer DEFAULT '0' NOT NULL,\n\
3116 timestamp integer DEFAULT '0' NOT NULL,\n\
3117 source varchar(64) DEFAULT '' NOT NULL,\n\
3118 severity integer DEFAULT '0' NOT NULL,\n\
3119 value text DEFAULT '' NOT NULL,\n\
3120 logeventid integer DEFAULT '0' NOT NULL,\n\
3121 ns integer DEFAULT '0' NOT NULL\n\
3122 );\n\
3123 CREATE INDEX history_log_1 ON history_log (itemid,clock);\n\
3124 CREATE TABLE history_text (\n\
3125 itemid bigint  NOT NULL,\n\
3126 clock integer DEFAULT '0' NOT NULL,\n\
3127 value text DEFAULT '' NOT NULL,\n\
3128 ns integer DEFAULT '0' NOT NULL\n\
3129 );\n\
3130 CREATE INDEX history_text_1 ON history_text (itemid,clock);\n\
3131 CREATE TABLE proxy_history (\n\
3132 id integer  NOT NULL PRIMARY KEY AUTOINCREMENT,\n\
3133 itemid bigint  NOT NULL,\n\
3134 clock integer DEFAULT '0' NOT NULL,\n\
3135 timestamp integer DEFAULT '0' NOT NULL,\n\
3136 source varchar(64) DEFAULT '' NOT NULL,\n\
3137 severity integer DEFAULT '0' NOT NULL,\n\
3138 value text DEFAULT '' NOT NULL,\n\
3139 logeventid integer DEFAULT '0' NOT NULL,\n\
3140 ns integer DEFAULT '0' NOT NULL,\n\
3141 state integer DEFAULT '0' NOT NULL,\n\
3142 lastlogsize bigint DEFAULT '0' NOT NULL,\n\
3143 mtime integer DEFAULT '0' NOT NULL,\n\
3144 flags integer DEFAULT '0' NOT NULL\n\
3145 );\n\
3146 CREATE INDEX proxy_history_1 ON proxy_history (clock);\n\
3147 CREATE TABLE proxy_dhistory (\n\
3148 id integer  NOT NULL PRIMARY KEY AUTOINCREMENT,\n\
3149 clock integer DEFAULT '0' NOT NULL,\n\
3150 druleid bigint  NOT NULL,\n\
3151 ip varchar(39) DEFAULT '' NOT NULL,\n\
3152 port integer DEFAULT '0' NOT NULL,\n\
3153 value varchar(255) DEFAULT '' NOT NULL,\n\
3154 status integer DEFAULT '0' NOT NULL,\n\
3155 dcheckid bigint  NULL,\n\
3156 dns varchar(255) DEFAULT '' NOT NULL\n\
3157 );\n\
3158 CREATE INDEX proxy_dhistory_1 ON proxy_dhistory (clock);\n\
3159 CREATE TABLE events (\n\
3160 eventid bigint  NOT NULL,\n\
3161 source integer DEFAULT '0' NOT NULL,\n\
3162 object integer DEFAULT '0' NOT NULL,\n\
3163 objectid bigint DEFAULT '0' NOT NULL,\n\
3164 clock integer DEFAULT '0' NOT NULL,\n\
3165 value integer DEFAULT '0' NOT NULL,\n\
3166 acknowledged integer DEFAULT '0' NOT NULL,\n\
3167 ns integer DEFAULT '0' NOT NULL,\n\
3168 name varchar(2048) DEFAULT '' NOT NULL,\n\
3169 severity integer DEFAULT '0' NOT NULL,\n\
3170 PRIMARY KEY (eventid)\n\
3171 );\n\
3172 CREATE INDEX events_1 ON events (source,object,objectid,clock);\n\
3173 CREATE INDEX events_2 ON events (source,object,clock);\n\
3174 CREATE TABLE trends (\n\
3175 itemid bigint  NOT NULL,\n\
3176 clock integer DEFAULT '0' NOT NULL,\n\
3177 num integer DEFAULT '0' NOT NULL,\n\
3178 value_min double(16,4) DEFAULT '0.0000' NOT NULL,\n\
3179 value_avg double(16,4) DEFAULT '0.0000' NOT NULL,\n\
3180 value_max double(16,4) DEFAULT '0.0000' NOT NULL,\n\
3181 PRIMARY KEY (itemid,clock)\n\
3182 );\n\
3183 CREATE TABLE trends_uint (\n\
3184 itemid bigint  NOT NULL,\n\
3185 clock integer DEFAULT '0' NOT NULL,\n\
3186 num integer DEFAULT '0' NOT NULL,\n\
3187 value_min bigint DEFAULT '0' NOT NULL,\n\
3188 value_avg bigint DEFAULT '0' NOT NULL,\n\
3189 value_max bigint DEFAULT '0' NOT NULL,\n\
3190 PRIMARY KEY (itemid,clock)\n\
3191 );\n\
3192 CREATE TABLE acknowledges (\n\
3193 acknowledgeid bigint  NOT NULL,\n\
3194 userid bigint  NOT NULL REFERENCES users (userid) ON DELETE CASCADE,\n\
3195 eventid bigint  NOT NULL REFERENCES events (eventid) ON DELETE CASCADE,\n\
3196 clock integer DEFAULT '0' NOT NULL,\n\
3197 message varchar(255) DEFAULT '' NOT NULL,\n\
3198 action integer DEFAULT '0' NOT NULL,\n\
3199 old_severity integer DEFAULT '0' NOT NULL,\n\
3200 new_severity integer DEFAULT '0' NOT NULL,\n\
3201 PRIMARY KEY (acknowledgeid)\n\
3202 );\n\
3203 CREATE INDEX acknowledges_1 ON acknowledges (userid);\n\
3204 CREATE INDEX acknowledges_2 ON acknowledges (eventid);\n\
3205 CREATE INDEX acknowledges_3 ON acknowledges (clock);\n\
3206 CREATE TABLE auditlog (\n\
3207 auditid bigint  NOT NULL,\n\
3208 userid bigint  NOT NULL REFERENCES users (userid) ON DELETE CASCADE,\n\
3209 clock integer DEFAULT '0' NOT NULL,\n\
3210 action integer DEFAULT '0' NOT NULL,\n\
3211 resourcetype integer DEFAULT '0' NOT NULL,\n\
3212 details varchar(128)  DEFAULT '0' NOT NULL,\n\
3213 ip varchar(39) DEFAULT '' NOT NULL,\n\
3214 resourceid bigint DEFAULT '0' NOT NULL,\n\
3215 resourcename varchar(255) DEFAULT '' NOT NULL,\n\
3216 PRIMARY KEY (auditid)\n\
3217 );\n\
3218 CREATE INDEX auditlog_1 ON auditlog (userid,clock);\n\
3219 CREATE INDEX auditlog_2 ON auditlog (clock);\n\
3220 CREATE TABLE auditlog_details (\n\
3221 auditdetailid bigint  NOT NULL,\n\
3222 auditid bigint  NOT NULL REFERENCES auditlog (auditid) ON DELETE CASCADE,\n\
3223 table_name varchar(64) DEFAULT '' NOT NULL,\n\
3224 field_name varchar(64) DEFAULT '' NOT NULL,\n\
3225 oldvalue text DEFAULT '' NOT NULL,\n\
3226 newvalue text DEFAULT '' NOT NULL,\n\
3227 PRIMARY KEY (auditdetailid)\n\
3228 );\n\
3229 CREATE INDEX auditlog_details_1 ON auditlog_details (auditid);\n\
3230 CREATE TABLE service_alarms (\n\
3231 servicealarmid bigint  NOT NULL,\n\
3232 serviceid bigint  NOT NULL REFERENCES services (serviceid) ON DELETE CASCADE,\n\
3233 clock integer DEFAULT '0' NOT NULL,\n\
3234 value integer DEFAULT '0' NOT NULL,\n\
3235 PRIMARY KEY (servicealarmid)\n\
3236 );\n\
3237 CREATE INDEX service_alarms_1 ON service_alarms (serviceid,clock);\n\
3238 CREATE INDEX service_alarms_2 ON service_alarms (clock);\n\
3239 CREATE TABLE autoreg_host (\n\
3240 autoreg_hostid bigint  NOT NULL,\n\
3241 proxy_hostid bigint  NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
3242 host varchar(64) DEFAULT '' NOT NULL,\n\
3243 listen_ip varchar(39) DEFAULT '' NOT NULL,\n\
3244 listen_port integer DEFAULT '0' NOT NULL,\n\
3245 listen_dns varchar(255) DEFAULT '' NOT NULL,\n\
3246 host_metadata varchar(255) DEFAULT '' NOT NULL,\n\
3247 PRIMARY KEY (autoreg_hostid)\n\
3248 );\n\
3249 CREATE INDEX autoreg_host_1 ON autoreg_host (host);\n\
3250 CREATE INDEX autoreg_host_2 ON autoreg_host (proxy_hostid);\n\
3251 CREATE TABLE proxy_autoreg_host (\n\
3252 id integer  NOT NULL PRIMARY KEY AUTOINCREMENT,\n\
3253 clock integer DEFAULT '0' NOT NULL,\n\
3254 host varchar(64) DEFAULT '' NOT NULL,\n\
3255 listen_ip varchar(39) DEFAULT '' NOT NULL,\n\
3256 listen_port integer DEFAULT '0' NOT NULL,\n\
3257 listen_dns varchar(255) DEFAULT '' NOT NULL,\n\
3258 host_metadata varchar(255) DEFAULT '' NOT NULL\n\
3259 );\n\
3260 CREATE INDEX proxy_autoreg_host_1 ON proxy_autoreg_host (clock);\n\
3261 CREATE TABLE dhosts (\n\
3262 dhostid bigint  NOT NULL,\n\
3263 druleid bigint  NOT NULL REFERENCES drules (druleid) ON DELETE CASCADE,\n\
3264 status integer DEFAULT '0' NOT NULL,\n\
3265 lastup integer DEFAULT '0' NOT NULL,\n\
3266 lastdown integer DEFAULT '0' NOT NULL,\n\
3267 PRIMARY KEY (dhostid)\n\
3268 );\n\
3269 CREATE INDEX dhosts_1 ON dhosts (druleid);\n\
3270 CREATE TABLE dservices (\n\
3271 dserviceid bigint  NOT NULL,\n\
3272 dhostid bigint  NOT NULL REFERENCES dhosts (dhostid) ON DELETE CASCADE,\n\
3273 value varchar(255) DEFAULT '' NOT NULL,\n\
3274 port integer DEFAULT '0' NOT NULL,\n\
3275 status integer DEFAULT '0' NOT NULL,\n\
3276 lastup integer DEFAULT '0' NOT NULL,\n\
3277 lastdown integer DEFAULT '0' NOT NULL,\n\
3278 dcheckid bigint  NOT NULL REFERENCES dchecks (dcheckid) ON DELETE CASCADE,\n\
3279 ip varchar(39) DEFAULT '' NOT NULL,\n\
3280 dns varchar(255) DEFAULT '' NOT NULL,\n\
3281 PRIMARY KEY (dserviceid)\n\
3282 );\n\
3283 CREATE UNIQUE INDEX dservices_1 ON dservices (dcheckid,ip,port);\n\
3284 CREATE INDEX dservices_2 ON dservices (dhostid);\n\
3285 CREATE TABLE escalations (\n\
3286 escalationid bigint  NOT NULL,\n\
3287 actionid bigint  NOT NULL,\n\
3288 triggerid bigint  NULL,\n\
3289 eventid bigint  NULL,\n\
3290 r_eventid bigint  NULL,\n\
3291 nextcheck integer DEFAULT '0' NOT NULL,\n\
3292 esc_step integer DEFAULT '0' NOT NULL,\n\
3293 status integer DEFAULT '0' NOT NULL,\n\
3294 itemid bigint  NULL,\n\
3295 acknowledgeid bigint  NULL,\n\
3296 PRIMARY KEY (escalationid)\n\
3297 );\n\
3298 CREATE UNIQUE INDEX escalations_1 ON escalations (triggerid,itemid,escalationid);\n\
3299 CREATE INDEX escalations_2 ON escalations (eventid);\n\
3300 CREATE INDEX escalations_3 ON escalations (nextcheck);\n\
3301 CREATE TABLE globalvars (\n\
3302 globalvarid bigint  NOT NULL,\n\
3303 snmp_lastsize bigint DEFAULT '0' NOT NULL,\n\
3304 PRIMARY KEY (globalvarid)\n\
3305 );\n\
3306 CREATE TABLE graph_discovery (\n\
3307 graphid bigint  NOT NULL REFERENCES graphs (graphid) ON DELETE CASCADE,\n\
3308 parent_graphid bigint  NOT NULL REFERENCES graphs (graphid),\n\
3309 PRIMARY KEY (graphid)\n\
3310 );\n\
3311 CREATE INDEX graph_discovery_1 ON graph_discovery (parent_graphid);\n\
3312 CREATE TABLE host_inventory (\n\
3313 hostid bigint  NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
3314 inventory_mode integer DEFAULT '0' NOT NULL,\n\
3315 type varchar(64) DEFAULT '' NOT NULL,\n\
3316 type_full varchar(64) DEFAULT '' NOT NULL,\n\
3317 name varchar(64) DEFAULT '' NOT NULL,\n\
3318 alias varchar(64) DEFAULT '' NOT NULL,\n\
3319 os varchar(64) DEFAULT '' NOT NULL,\n\
3320 os_full varchar(255) DEFAULT '' NOT NULL,\n\
3321 os_short varchar(64) DEFAULT '' NOT NULL,\n\
3322 serialno_a varchar(64) DEFAULT '' NOT NULL,\n\
3323 serialno_b varchar(64) DEFAULT '' NOT NULL,\n\
3324 tag varchar(64) DEFAULT '' NOT NULL,\n\
3325 asset_tag varchar(64) DEFAULT '' NOT NULL,\n\
3326 macaddress_a varchar(64) DEFAULT '' NOT NULL,\n\
3327 macaddress_b varchar(64) DEFAULT '' NOT NULL,\n\
3328 hardware varchar(255) DEFAULT '' NOT NULL,\n\
3329 hardware_full text DEFAULT '' NOT NULL,\n\
3330 software varchar(255) DEFAULT '' NOT NULL,\n\
3331 software_full text DEFAULT '' NOT NULL,\n\
3332 software_app_a varchar(64) DEFAULT '' NOT NULL,\n\
3333 software_app_b varchar(64) DEFAULT '' NOT NULL,\n\
3334 software_app_c varchar(64) DEFAULT '' NOT NULL,\n\
3335 software_app_d varchar(64) DEFAULT '' NOT NULL,\n\
3336 software_app_e varchar(64) DEFAULT '' NOT NULL,\n\
3337 contact text DEFAULT '' NOT NULL,\n\
3338 location text DEFAULT '' NOT NULL,\n\
3339 location_lat varchar(16) DEFAULT '' NOT NULL,\n\
3340 location_lon varchar(16) DEFAULT '' NOT NULL,\n\
3341 notes text DEFAULT '' NOT NULL,\n\
3342 chassis varchar(64) DEFAULT '' NOT NULL,\n\
3343 model varchar(64) DEFAULT '' NOT NULL,\n\
3344 hw_arch varchar(32) DEFAULT '' NOT NULL,\n\
3345 vendor varchar(64) DEFAULT '' NOT NULL,\n\
3346 contract_number varchar(64) DEFAULT '' NOT NULL,\n\
3347 installer_name varchar(64) DEFAULT '' NOT NULL,\n\
3348 deployment_status varchar(64) DEFAULT '' NOT NULL,\n\
3349 url_a varchar(255) DEFAULT '' NOT NULL,\n\
3350 url_b varchar(255) DEFAULT '' NOT NULL,\n\
3351 url_c varchar(255) DEFAULT '' NOT NULL,\n\
3352 host_networks text DEFAULT '' NOT NULL,\n\
3353 host_netmask varchar(39) DEFAULT '' NOT NULL,\n\
3354 host_router varchar(39) DEFAULT '' NOT NULL,\n\
3355 oob_ip varchar(39) DEFAULT '' NOT NULL,\n\
3356 oob_netmask varchar(39) DEFAULT '' NOT NULL,\n\
3357 oob_router varchar(39) DEFAULT '' NOT NULL,\n\
3358 date_hw_purchase varchar(64) DEFAULT '' NOT NULL,\n\
3359 date_hw_install varchar(64) DEFAULT '' NOT NULL,\n\
3360 date_hw_expiry varchar(64) DEFAULT '' NOT NULL,\n\
3361 date_hw_decomm varchar(64) DEFAULT '' NOT NULL,\n\
3362 site_address_a varchar(128) DEFAULT '' NOT NULL,\n\
3363 site_address_b varchar(128) DEFAULT '' NOT NULL,\n\
3364 site_address_c varchar(128) DEFAULT '' NOT NULL,\n\
3365 site_city varchar(128) DEFAULT '' NOT NULL,\n\
3366 site_state varchar(64) DEFAULT '' NOT NULL,\n\
3367 site_country varchar(64) DEFAULT '' NOT NULL,\n\
3368 site_zip varchar(64) DEFAULT '' NOT NULL,\n\
3369 site_rack varchar(128) DEFAULT '' NOT NULL,\n\
3370 site_notes text DEFAULT '' NOT NULL,\n\
3371 poc_1_name varchar(128) DEFAULT '' NOT NULL,\n\
3372 poc_1_email varchar(128) DEFAULT '' NOT NULL,\n\
3373 poc_1_phone_a varchar(64) DEFAULT '' NOT NULL,\n\
3374 poc_1_phone_b varchar(64) DEFAULT '' NOT NULL,\n\
3375 poc_1_cell varchar(64) DEFAULT '' NOT NULL,\n\
3376 poc_1_screen varchar(64) DEFAULT '' NOT NULL,\n\
3377 poc_1_notes text DEFAULT '' NOT NULL,\n\
3378 poc_2_name varchar(128) DEFAULT '' NOT NULL,\n\
3379 poc_2_email varchar(128) DEFAULT '' NOT NULL,\n\
3380 poc_2_phone_a varchar(64) DEFAULT '' NOT NULL,\n\
3381 poc_2_phone_b varchar(64) DEFAULT '' NOT NULL,\n\
3382 poc_2_cell varchar(64) DEFAULT '' NOT NULL,\n\
3383 poc_2_screen varchar(64) DEFAULT '' NOT NULL,\n\
3384 poc_2_notes text DEFAULT '' NOT NULL,\n\
3385 PRIMARY KEY (hostid)\n\
3386 );\n\
3387 CREATE TABLE housekeeper (\n\
3388 housekeeperid bigint  NOT NULL,\n\
3389 tablename varchar(64) DEFAULT '' NOT NULL,\n\
3390 field varchar(64) DEFAULT '' NOT NULL,\n\
3391 value bigint  NOT NULL,\n\
3392 PRIMARY KEY (housekeeperid)\n\
3393 );\n\
3394 CREATE TABLE images (\n\
3395 imageid bigint  NOT NULL,\n\
3396 imagetype integer DEFAULT '0' NOT NULL,\n\
3397 name varchar(64) DEFAULT '0' NOT NULL,\n\
3398 image longblob DEFAULT '' NOT NULL,\n\
3399 PRIMARY KEY (imageid)\n\
3400 );\n\
3401 CREATE UNIQUE INDEX images_1 ON images (name);\n\
3402 CREATE TABLE item_discovery (\n\
3403 itemdiscoveryid bigint  NOT NULL,\n\
3404 itemid bigint  NOT NULL REFERENCES items (itemid) ON DELETE CASCADE,\n\
3405 parent_itemid bigint  NOT NULL REFERENCES items (itemid) ON DELETE CASCADE,\n\
3406 key_ varchar(255) DEFAULT '' NOT NULL,\n\
3407 lastcheck integer DEFAULT '0' NOT NULL,\n\
3408 ts_delete integer DEFAULT '0' NOT NULL,\n\
3409 PRIMARY KEY (itemdiscoveryid)\n\
3410 );\n\
3411 CREATE UNIQUE INDEX item_discovery_1 ON item_discovery (itemid,parent_itemid);\n\
3412 CREATE INDEX item_discovery_2 ON item_discovery (parent_itemid);\n\
3413 CREATE TABLE host_discovery (\n\
3414 hostid bigint  NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
3415 parent_hostid bigint  NULL REFERENCES hosts (hostid),\n\
3416 parent_itemid bigint  NULL REFERENCES items (itemid),\n\
3417 host varchar(64) DEFAULT '' NOT NULL,\n\
3418 lastcheck integer DEFAULT '0' NOT NULL,\n\
3419 ts_delete integer DEFAULT '0' NOT NULL,\n\
3420 PRIMARY KEY (hostid)\n\
3421 );\n\
3422 CREATE TABLE interface_discovery (\n\
3423 interfaceid bigint  NOT NULL REFERENCES interface (interfaceid) ON DELETE CASCADE,\n\
3424 parent_interfaceid bigint  NOT NULL REFERENCES interface (interfaceid) ON DELETE CASCADE,\n\
3425 PRIMARY KEY (interfaceid)\n\
3426 );\n\
3427 CREATE TABLE profiles (\n\
3428 profileid bigint  NOT NULL,\n\
3429 userid bigint  NOT NULL REFERENCES users (userid) ON DELETE CASCADE,\n\
3430 idx varchar(96) DEFAULT '' NOT NULL,\n\
3431 idx2 bigint DEFAULT '0' NOT NULL,\n\
3432 value_id bigint DEFAULT '0' NOT NULL,\n\
3433 value_int integer DEFAULT '0' NOT NULL,\n\
3434 value_str varchar(255) DEFAULT '' NOT NULL,\n\
3435 source varchar(96) DEFAULT '' NOT NULL,\n\
3436 type integer DEFAULT '0' NOT NULL,\n\
3437 PRIMARY KEY (profileid)\n\
3438 );\n\
3439 CREATE INDEX profiles_1 ON profiles (userid,idx,idx2);\n\
3440 CREATE INDEX profiles_2 ON profiles (userid,profileid);\n\
3441 CREATE TABLE sessions (\n\
3442 sessionid varchar(32) DEFAULT '' NOT NULL,\n\
3443 userid bigint  NOT NULL REFERENCES users (userid) ON DELETE CASCADE,\n\
3444 lastaccess integer DEFAULT '0' NOT NULL,\n\
3445 status integer DEFAULT '0' NOT NULL,\n\
3446 PRIMARY KEY (sessionid)\n\
3447 );\n\
3448 CREATE INDEX sessions_1 ON sessions (userid,status,lastaccess);\n\
3449 CREATE TABLE trigger_discovery (\n\
3450 triggerid bigint  NOT NULL REFERENCES triggers (triggerid) ON DELETE CASCADE,\n\
3451 parent_triggerid bigint  NOT NULL REFERENCES triggers (triggerid),\n\
3452 PRIMARY KEY (triggerid)\n\
3453 );\n\
3454 CREATE INDEX trigger_discovery_1 ON trigger_discovery (parent_triggerid);\n\
3455 CREATE TABLE application_template (\n\
3456 application_templateid bigint  NOT NULL,\n\
3457 applicationid bigint  NOT NULL REFERENCES applications (applicationid) ON DELETE CASCADE,\n\
3458 templateid bigint  NOT NULL REFERENCES applications (applicationid) ON DELETE CASCADE,\n\
3459 PRIMARY KEY (application_templateid)\n\
3460 );\n\
3461 CREATE UNIQUE INDEX application_template_1 ON application_template (applicationid,templateid);\n\
3462 CREATE INDEX application_template_2 ON application_template (templateid);\n\
3463 CREATE TABLE item_condition (\n\
3464 item_conditionid bigint  NOT NULL,\n\
3465 itemid bigint  NOT NULL REFERENCES items (itemid) ON DELETE CASCADE,\n\
3466 operator integer DEFAULT '8' NOT NULL,\n\
3467 macro varchar(64) DEFAULT '' NOT NULL,\n\
3468 value varchar(255) DEFAULT '' NOT NULL,\n\
3469 PRIMARY KEY (item_conditionid)\n\
3470 );\n\
3471 CREATE INDEX item_condition_1 ON item_condition (itemid);\n\
3472 CREATE TABLE application_prototype (\n\
3473 application_prototypeid bigint  NOT NULL,\n\
3474 itemid bigint  NOT NULL REFERENCES items (itemid) ON DELETE CASCADE,\n\
3475 templateid bigint  NULL REFERENCES application_prototype (application_prototypeid) ON DELETE CASCADE,\n\
3476 name varchar(255) DEFAULT '' NOT NULL,\n\
3477 PRIMARY KEY (application_prototypeid)\n\
3478 );\n\
3479 CREATE INDEX application_prototype_1 ON application_prototype (itemid);\n\
3480 CREATE INDEX application_prototype_2 ON application_prototype (templateid);\n\
3481 CREATE TABLE item_application_prototype (\n\
3482 item_application_prototypeid bigint  NOT NULL,\n\
3483 application_prototypeid bigint  NOT NULL REFERENCES application_prototype (application_prototypeid) ON DELETE CASCADE,\n\
3484 itemid bigint  NOT NULL REFERENCES items (itemid) ON DELETE CASCADE,\n\
3485 PRIMARY KEY (item_application_prototypeid)\n\
3486 );\n\
3487 CREATE UNIQUE INDEX item_application_prototype_1 ON item_application_prototype (application_prototypeid,itemid);\n\
3488 CREATE INDEX item_application_prototype_2 ON item_application_prototype (itemid);\n\
3489 CREATE TABLE application_discovery (\n\
3490 application_discoveryid bigint  NOT NULL,\n\
3491 applicationid bigint  NOT NULL REFERENCES applications (applicationid) ON DELETE CASCADE,\n\
3492 application_prototypeid bigint  NOT NULL REFERENCES application_prototype (application_prototypeid) ON DELETE CASCADE,\n\
3493 name varchar(255) DEFAULT '' NOT NULL,\n\
3494 lastcheck integer DEFAULT '0' NOT NULL,\n\
3495 ts_delete integer DEFAULT '0' NOT NULL,\n\
3496 PRIMARY KEY (application_discoveryid)\n\
3497 );\n\
3498 CREATE INDEX application_discovery_1 ON application_discovery (applicationid);\n\
3499 CREATE INDEX application_discovery_2 ON application_discovery (application_prototypeid);\n\
3500 CREATE TABLE opinventory (\n\
3501 operationid bigint  NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE,\n\
3502 inventory_mode integer DEFAULT '0' NOT NULL,\n\
3503 PRIMARY KEY (operationid)\n\
3504 );\n\
3505 CREATE TABLE trigger_tag (\n\
3506 triggertagid bigint  NOT NULL,\n\
3507 triggerid bigint  NOT NULL REFERENCES triggers (triggerid) ON DELETE CASCADE,\n\
3508 tag varchar(255) DEFAULT '' NOT NULL,\n\
3509 value varchar(255) DEFAULT '' NOT NULL,\n\
3510 PRIMARY KEY (triggertagid)\n\
3511 );\n\
3512 CREATE INDEX trigger_tag_1 ON trigger_tag (triggerid);\n\
3513 CREATE TABLE event_tag (\n\
3514 eventtagid bigint  NOT NULL,\n\
3515 eventid bigint  NOT NULL REFERENCES events (eventid) ON DELETE CASCADE,\n\
3516 tag varchar(255) DEFAULT '' NOT NULL,\n\
3517 value varchar(255) DEFAULT '' NOT NULL,\n\
3518 PRIMARY KEY (eventtagid)\n\
3519 );\n\
3520 CREATE INDEX event_tag_1 ON event_tag (eventid);\n\
3521 CREATE TABLE problem (\n\
3522 eventid bigint  NOT NULL REFERENCES events (eventid) ON DELETE CASCADE,\n\
3523 source integer DEFAULT '0' NOT NULL,\n\
3524 object integer DEFAULT '0' NOT NULL,\n\
3525 objectid bigint DEFAULT '0' NOT NULL,\n\
3526 clock integer DEFAULT '0' NOT NULL,\n\
3527 ns integer DEFAULT '0' NOT NULL,\n\
3528 r_eventid bigint  NULL REFERENCES events (eventid) ON DELETE CASCADE,\n\
3529 r_clock integer DEFAULT '0' NOT NULL,\n\
3530 r_ns integer DEFAULT '0' NOT NULL,\n\
3531 correlationid bigint  NULL,\n\
3532 userid bigint  NULL,\n\
3533 name varchar(2048) DEFAULT '' NOT NULL,\n\
3534 acknowledged integer DEFAULT '0' NOT NULL,\n\
3535 severity integer DEFAULT '0' NOT NULL,\n\
3536 PRIMARY KEY (eventid)\n\
3537 );\n\
3538 CREATE INDEX problem_1 ON problem (source,object,objectid);\n\
3539 CREATE INDEX problem_2 ON problem (r_clock);\n\
3540 CREATE INDEX problem_3 ON problem (r_eventid);\n\
3541 CREATE TABLE problem_tag (\n\
3542 problemtagid bigint  NOT NULL,\n\
3543 eventid bigint  NOT NULL REFERENCES problem (eventid) ON DELETE CASCADE,\n\
3544 tag varchar(255) DEFAULT '' NOT NULL,\n\
3545 value varchar(255) DEFAULT '' NOT NULL,\n\
3546 PRIMARY KEY (problemtagid)\n\
3547 );\n\
3548 CREATE INDEX problem_tag_1 ON problem_tag (eventid,tag,value);\n\
3549 CREATE TABLE tag_filter (\n\
3550 tag_filterid bigint  NOT NULL,\n\
3551 usrgrpid bigint  NOT NULL REFERENCES usrgrp (usrgrpid) ON DELETE CASCADE,\n\
3552 groupid bigint  NOT NULL REFERENCES hstgrp (groupid) ON DELETE CASCADE,\n\
3553 tag varchar(255) DEFAULT ''  NOT NULL,\n\
3554 value varchar(255) DEFAULT ''  NOT NULL,\n\
3555 PRIMARY KEY (tag_filterid)\n\
3556 );\n\
3557 CREATE TABLE event_recovery (\n\
3558 eventid bigint  NOT NULL REFERENCES events (eventid) ON DELETE CASCADE,\n\
3559 r_eventid bigint  NOT NULL REFERENCES events (eventid) ON DELETE CASCADE,\n\
3560 c_eventid bigint  NULL REFERENCES events (eventid) ON DELETE CASCADE,\n\
3561 correlationid bigint  NULL,\n\
3562 userid bigint  NULL,\n\
3563 PRIMARY KEY (eventid)\n\
3564 );\n\
3565 CREATE INDEX event_recovery_1 ON event_recovery (r_eventid);\n\
3566 CREATE INDEX event_recovery_2 ON event_recovery (c_eventid);\n\
3567 CREATE TABLE correlation (\n\
3568 correlationid bigint  NOT NULL,\n\
3569 name varchar(255) DEFAULT '' NOT NULL,\n\
3570 description text DEFAULT '' NOT NULL,\n\
3571 evaltype integer DEFAULT '0' NOT NULL,\n\
3572 status integer DEFAULT '0' NOT NULL,\n\
3573 formula varchar(255) DEFAULT '' NOT NULL,\n\
3574 PRIMARY KEY (correlationid)\n\
3575 );\n\
3576 CREATE INDEX correlation_1 ON correlation (status);\n\
3577 CREATE UNIQUE INDEX correlation_2 ON correlation (name);\n\
3578 CREATE TABLE corr_condition (\n\
3579 corr_conditionid bigint  NOT NULL,\n\
3580 correlationid bigint  NOT NULL REFERENCES correlation (correlationid) ON DELETE CASCADE,\n\
3581 type integer DEFAULT '0' NOT NULL,\n\
3582 PRIMARY KEY (corr_conditionid)\n\
3583 );\n\
3584 CREATE INDEX corr_condition_1 ON corr_condition (correlationid);\n\
3585 CREATE TABLE corr_condition_tag (\n\
3586 corr_conditionid bigint  NOT NULL REFERENCES corr_condition (corr_conditionid) ON DELETE CASCADE,\n\
3587 tag varchar(255) DEFAULT '' NOT NULL,\n\
3588 PRIMARY KEY (corr_conditionid)\n\
3589 );\n\
3590 CREATE TABLE corr_condition_group (\n\
3591 corr_conditionid bigint  NOT NULL REFERENCES corr_condition (corr_conditionid) ON DELETE CASCADE,\n\
3592 operator integer DEFAULT '0' NOT NULL,\n\
3593 groupid bigint  NOT NULL REFERENCES hstgrp (groupid),\n\
3594 PRIMARY KEY (corr_conditionid)\n\
3595 );\n\
3596 CREATE INDEX corr_condition_group_1 ON corr_condition_group (groupid);\n\
3597 CREATE TABLE corr_condition_tagpair (\n\
3598 corr_conditionid bigint  NOT NULL REFERENCES corr_condition (corr_conditionid) ON DELETE CASCADE,\n\
3599 oldtag varchar(255) DEFAULT '' NOT NULL,\n\
3600 newtag varchar(255) DEFAULT '' NOT NULL,\n\
3601 PRIMARY KEY (corr_conditionid)\n\
3602 );\n\
3603 CREATE TABLE corr_condition_tagvalue (\n\
3604 corr_conditionid bigint  NOT NULL REFERENCES corr_condition (corr_conditionid) ON DELETE CASCADE,\n\
3605 tag varchar(255) DEFAULT '' NOT NULL,\n\
3606 operator integer DEFAULT '0' NOT NULL,\n\
3607 value varchar(255) DEFAULT '' NOT NULL,\n\
3608 PRIMARY KEY (corr_conditionid)\n\
3609 );\n\
3610 CREATE TABLE corr_operation (\n\
3611 corr_operationid bigint  NOT NULL,\n\
3612 correlationid bigint  NOT NULL REFERENCES correlation (correlationid) ON DELETE CASCADE,\n\
3613 type integer DEFAULT '0' NOT NULL,\n\
3614 PRIMARY KEY (corr_operationid)\n\
3615 );\n\
3616 CREATE INDEX corr_operation_1 ON corr_operation (correlationid);\n\
3617 CREATE TABLE task (\n\
3618 taskid bigint  NOT NULL,\n\
3619 type integer  NOT NULL,\n\
3620 status integer DEFAULT '0' NOT NULL,\n\
3621 clock integer DEFAULT '0' NOT NULL,\n\
3622 ttl integer DEFAULT '0' NOT NULL,\n\
3623 proxy_hostid bigint  NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
3624 PRIMARY KEY (taskid)\n\
3625 );\n\
3626 CREATE INDEX task_1 ON task (status,proxy_hostid);\n\
3627 CREATE TABLE task_close_problem (\n\
3628 taskid bigint  NOT NULL REFERENCES task (taskid) ON DELETE CASCADE,\n\
3629 acknowledgeid bigint  NOT NULL,\n\
3630 PRIMARY KEY (taskid)\n\
3631 );\n\
3632 CREATE TABLE item_preproc (\n\
3633 item_preprocid bigint  NOT NULL,\n\
3634 itemid bigint  NOT NULL REFERENCES items (itemid) ON DELETE CASCADE,\n\
3635 step integer DEFAULT '0' NOT NULL,\n\
3636 type integer DEFAULT '0' NOT NULL,\n\
3637 params varchar(255) DEFAULT '' NOT NULL,\n\
3638 PRIMARY KEY (item_preprocid)\n\
3639 );\n\
3640 CREATE INDEX item_preproc_1 ON item_preproc (itemid,step);\n\
3641 CREATE TABLE task_remote_command (\n\
3642 taskid bigint  NOT NULL REFERENCES task (taskid) ON DELETE CASCADE,\n\
3643 command_type integer DEFAULT '0' NOT NULL,\n\
3644 execute_on integer DEFAULT '0' NOT NULL,\n\
3645 port integer DEFAULT '0' NOT NULL,\n\
3646 authtype integer DEFAULT '0' NOT NULL,\n\
3647 username varchar(64) DEFAULT '' NOT NULL,\n\
3648 password varchar(64) DEFAULT '' NOT NULL,\n\
3649 publickey varchar(64) DEFAULT '' NOT NULL,\n\
3650 privatekey varchar(64) DEFAULT '' NOT NULL,\n\
3651 command text DEFAULT '' NOT NULL,\n\
3652 alertid bigint  NULL,\n\
3653 parent_taskid bigint  NOT NULL,\n\
3654 hostid bigint  NOT NULL,\n\
3655 PRIMARY KEY (taskid)\n\
3656 );\n\
3657 CREATE TABLE task_remote_command_result (\n\
3658 taskid bigint  NOT NULL REFERENCES task (taskid) ON DELETE CASCADE,\n\
3659 status integer DEFAULT '0' NOT NULL,\n\
3660 parent_taskid bigint  NOT NULL,\n\
3661 info text DEFAULT '' NOT NULL,\n\
3662 PRIMARY KEY (taskid)\n\
3663 );\n\
3664 CREATE TABLE task_acknowledge (\n\
3665 taskid bigint  NOT NULL REFERENCES task (taskid) ON DELETE CASCADE,\n\
3666 acknowledgeid bigint  NOT NULL,\n\
3667 PRIMARY KEY (taskid)\n\
3668 );\n\
3669 CREATE TABLE sysmap_shape (\n\
3670 sysmap_shapeid bigint  NOT NULL,\n\
3671 sysmapid bigint  NOT NULL REFERENCES sysmaps (sysmapid) ON DELETE CASCADE,\n\
3672 type integer DEFAULT '0' NOT NULL,\n\
3673 x integer DEFAULT '0' NOT NULL,\n\
3674 y integer DEFAULT '0' NOT NULL,\n\
3675 width integer DEFAULT '200' NOT NULL,\n\
3676 height integer DEFAULT '200' NOT NULL,\n\
3677 text text DEFAULT '' NOT NULL,\n\
3678 font integer DEFAULT '9' NOT NULL,\n\
3679 font_size integer DEFAULT '11' NOT NULL,\n\
3680 font_color varchar(6) DEFAULT '000000' NOT NULL,\n\
3681 text_halign integer DEFAULT '0' NOT NULL,\n\
3682 text_valign integer DEFAULT '0' NOT NULL,\n\
3683 border_type integer DEFAULT '0' NOT NULL,\n\
3684 border_width integer DEFAULT '1' NOT NULL,\n\
3685 border_color varchar(6) DEFAULT '000000' NOT NULL,\n\
3686 background_color varchar(6) DEFAULT '' NOT NULL,\n\
3687 zindex integer DEFAULT '0' NOT NULL,\n\
3688 PRIMARY KEY (sysmap_shapeid)\n\
3689 );\n\
3690 CREATE INDEX sysmap_shape_1 ON sysmap_shape (sysmapid);\n\
3691 CREATE TABLE sysmap_element_trigger (\n\
3692 selement_triggerid bigint  NOT NULL,\n\
3693 selementid bigint  NOT NULL REFERENCES sysmaps_elements (selementid) ON DELETE CASCADE,\n\
3694 triggerid bigint  NOT NULL REFERENCES triggers (triggerid) ON DELETE CASCADE,\n\
3695 PRIMARY KEY (selement_triggerid)\n\
3696 );\n\
3697 CREATE UNIQUE INDEX sysmap_element_trigger_1 ON sysmap_element_trigger (selementid,triggerid);\n\
3698 CREATE TABLE httptest_field (\n\
3699 httptest_fieldid bigint  NOT NULL,\n\
3700 httptestid bigint  NOT NULL REFERENCES httptest (httptestid) ON DELETE CASCADE,\n\
3701 type integer DEFAULT '0' NOT NULL,\n\
3702 name varchar(255) DEFAULT '' NOT NULL,\n\
3703 value text DEFAULT '' NOT NULL,\n\
3704 PRIMARY KEY (httptest_fieldid)\n\
3705 );\n\
3706 CREATE INDEX httptest_field_1 ON httptest_field (httptestid);\n\
3707 CREATE TABLE httpstep_field (\n\
3708 httpstep_fieldid bigint  NOT NULL,\n\
3709 httpstepid bigint  NOT NULL REFERENCES httpstep (httpstepid) ON DELETE CASCADE,\n\
3710 type integer DEFAULT '0' NOT NULL,\n\
3711 name varchar(255) DEFAULT '' NOT NULL,\n\
3712 value text DEFAULT '' NOT NULL,\n\
3713 PRIMARY KEY (httpstep_fieldid)\n\
3714 );\n\
3715 CREATE INDEX httpstep_field_1 ON httpstep_field (httpstepid);\n\
3716 CREATE TABLE dashboard (\n\
3717 dashboardid bigint  NOT NULL,\n\
3718 name varchar(255)  NOT NULL,\n\
3719 userid bigint  NOT NULL REFERENCES users (userid),\n\
3720 private integer DEFAULT '1' NOT NULL,\n\
3721 PRIMARY KEY (dashboardid)\n\
3722 );\n\
3723 CREATE TABLE dashboard_user (\n\
3724 dashboard_userid bigint  NOT NULL,\n\
3725 dashboardid bigint  NOT NULL REFERENCES dashboard (dashboardid) ON DELETE CASCADE,\n\
3726 userid bigint  NOT NULL REFERENCES users (userid) ON DELETE CASCADE,\n\
3727 permission integer DEFAULT '2' NOT NULL,\n\
3728 PRIMARY KEY (dashboard_userid)\n\
3729 );\n\
3730 CREATE UNIQUE INDEX dashboard_user_1 ON dashboard_user (dashboardid,userid);\n\
3731 CREATE TABLE dashboard_usrgrp (\n\
3732 dashboard_usrgrpid bigint  NOT NULL,\n\
3733 dashboardid bigint  NOT NULL REFERENCES dashboard (dashboardid) ON DELETE CASCADE,\n\
3734 usrgrpid bigint  NOT NULL REFERENCES usrgrp (usrgrpid) ON DELETE CASCADE,\n\
3735 permission integer DEFAULT '2' NOT NULL,\n\
3736 PRIMARY KEY (dashboard_usrgrpid)\n\
3737 );\n\
3738 CREATE UNIQUE INDEX dashboard_usrgrp_1 ON dashboard_usrgrp (dashboardid,usrgrpid);\n\
3739 CREATE TABLE widget (\n\
3740 widgetid bigint  NOT NULL,\n\
3741 dashboardid bigint  NOT NULL REFERENCES dashboard (dashboardid) ON DELETE CASCADE,\n\
3742 type varchar(255) DEFAULT '' NOT NULL,\n\
3743 name varchar(255) DEFAULT '' NOT NULL,\n\
3744 x integer DEFAULT '0' NOT NULL,\n\
3745 y integer DEFAULT '0' NOT NULL,\n\
3746 width integer DEFAULT '1' NOT NULL,\n\
3747 height integer DEFAULT '1' NOT NULL,\n\
3748 PRIMARY KEY (widgetid)\n\
3749 );\n\
3750 CREATE INDEX widget_1 ON widget (dashboardid);\n\
3751 CREATE TABLE widget_field (\n\
3752 widget_fieldid bigint  NOT NULL,\n\
3753 widgetid bigint  NOT NULL REFERENCES widget (widgetid) ON DELETE CASCADE,\n\
3754 type integer DEFAULT '0' NOT NULL,\n\
3755 name varchar(255) DEFAULT '' NOT NULL,\n\
3756 value_int integer DEFAULT '0' NOT NULL,\n\
3757 value_str varchar(255) DEFAULT '' NOT NULL,\n\
3758 value_groupid bigint  NULL REFERENCES hstgrp (groupid) ON DELETE CASCADE,\n\
3759 value_hostid bigint  NULL REFERENCES hosts (hostid) ON DELETE CASCADE,\n\
3760 value_itemid bigint  NULL REFERENCES items (itemid) ON DELETE CASCADE,\n\
3761 value_graphid bigint  NULL REFERENCES graphs (graphid) ON DELETE CASCADE,\n\
3762 value_sysmapid bigint  NULL REFERENCES sysmaps (sysmapid) ON DELETE CASCADE,\n\
3763 PRIMARY KEY (widget_fieldid)\n\
3764 );\n\
3765 CREATE INDEX widget_field_1 ON widget_field (widgetid);\n\
3766 CREATE INDEX widget_field_2 ON widget_field (value_groupid);\n\
3767 CREATE INDEX widget_field_3 ON widget_field (value_hostid);\n\
3768 CREATE INDEX widget_field_4 ON widget_field (value_itemid);\n\
3769 CREATE INDEX widget_field_5 ON widget_field (value_graphid);\n\
3770 CREATE INDEX widget_field_6 ON widget_field (value_sysmapid);\n\
3771 CREATE TABLE task_check_now (\n\
3772 taskid bigint  NOT NULL REFERENCES task (taskid) ON DELETE CASCADE,\n\
3773 itemid bigint  NOT NULL,\n\
3774 PRIMARY KEY (taskid)\n\
3775 );\n\
3776 CREATE TABLE event_suppress (\n\
3777 event_suppressid bigint  NOT NULL,\n\
3778 eventid bigint  NOT NULL REFERENCES events (eventid) ON DELETE CASCADE,\n\
3779 maintenanceid bigint  NULL REFERENCES maintenances (maintenanceid) ON DELETE CASCADE,\n\
3780 suppress_until integer DEFAULT '0' NOT NULL,\n\
3781 PRIMARY KEY (event_suppressid)\n\
3782 );\n\
3783 CREATE UNIQUE INDEX event_suppress_1 ON event_suppress (eventid,maintenanceid);\n\
3784 CREATE INDEX event_suppress_2 ON event_suppress (suppress_until);\n\
3785 CREATE INDEX event_suppress_3 ON event_suppress (maintenanceid);\n\
3786 CREATE TABLE maintenance_tag (\n\
3787 maintenancetagid bigint  NOT NULL,\n\
3788 maintenanceid bigint  NOT NULL REFERENCES maintenances (maintenanceid) ON DELETE CASCADE,\n\
3789 tag varchar(255) DEFAULT '' NOT NULL,\n\
3790 operator integer DEFAULT '2' NOT NULL,\n\
3791 value varchar(255) DEFAULT '' NOT NULL,\n\
3792 PRIMARY KEY (maintenancetagid)\n\
3793 );\n\
3794 CREATE INDEX maintenance_tag_1 ON maintenance_tag (maintenanceid);\n\
3795 CREATE TABLE dbversion (\n\
3796 mandatory integer DEFAULT '0' NOT NULL,\n\
3797 optional integer DEFAULT '0' NOT NULL\n\
3798 );\n\
3799 INSERT INTO dbversion VALUES ('4000000','4000006');\n\
3800 ";
3801 const char	*const db_schema_fkeys[] = {
3802 	NULL
3803 };
3804 #else	/* HAVE_SQLITE3 */
3805 const char	*const db_schema = NULL;
3806 #endif	/* not HAVE_SQLITE3 */
3807