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