CREATE TABLE `users` (
	`userid`                 bigint unsigned                           NOT NULL,
	`alias`                  varchar(100)    DEFAULT ''                NOT NULL,
	`name`                   varchar(100)    DEFAULT ''                NOT NULL,
	`surname`                varchar(100)    DEFAULT ''                NOT NULL,
	`passwd`                 varchar(32)     DEFAULT ''                NOT NULL,
	`url`                    varchar(255)    DEFAULT ''                NOT NULL,
	`autologin`              integer         DEFAULT '0'               NOT NULL,
	`autologout`             varchar(32)     DEFAULT '15m'             NOT NULL,
	`lang`                   varchar(5)      DEFAULT 'en_GB'           NOT NULL,
	`refresh`                varchar(32)     DEFAULT '30s'             NOT NULL,
	`type`                   integer         DEFAULT '1'               NOT NULL,
	`theme`                  varchar(128)    DEFAULT 'default'         NOT NULL,
	`attempt_failed`         integer         DEFAULT 0                 NOT NULL,
	`attempt_ip`             varchar(39)     DEFAULT ''                NOT NULL,
	`attempt_clock`          integer         DEFAULT 0                 NOT NULL,
	`rows_per_page`          integer         DEFAULT 50                NOT NULL,
	PRIMARY KEY (userid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `users_1` ON `users` (`alias`);
CREATE TABLE `maintenances` (
	`maintenanceid`          bigint unsigned                           NOT NULL,
	`name`                   varchar(128)    DEFAULT ''                NOT NULL,
	`maintenance_type`       integer         DEFAULT '0'               NOT NULL,
	`description`            text                                      NOT NULL,
	`active_since`           integer         DEFAULT '0'               NOT NULL,
	`active_till`            integer         DEFAULT '0'               NOT NULL,
	`tags_evaltype`          integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (maintenanceid)
) ENGINE=InnoDB;
CREATE INDEX `maintenances_1` ON `maintenances` (`active_since`,`active_till`);
CREATE UNIQUE INDEX `maintenances_2` ON `maintenances` (`name`);
CREATE TABLE `hosts` (
	`hostid`                 bigint unsigned                           NOT NULL,
	`proxy_hostid`           bigint unsigned                           NULL,
	`host`                   varchar(128)    DEFAULT ''                NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	`disable_until`          integer         DEFAULT '0'               NOT NULL,
	`error`                  varchar(2048)   DEFAULT ''                NOT NULL,
	`available`              integer         DEFAULT '0'               NOT NULL,
	`errors_from`            integer         DEFAULT '0'               NOT NULL,
	`lastaccess`             integer         DEFAULT '0'               NOT NULL,
	`ipmi_authtype`          integer         DEFAULT '-1'              NOT NULL,
	`ipmi_privilege`         integer         DEFAULT '2'               NOT NULL,
	`ipmi_username`          varchar(16)     DEFAULT ''                NOT NULL,
	`ipmi_password`          varchar(20)     DEFAULT ''                NOT NULL,
	`ipmi_disable_until`     integer         DEFAULT '0'               NOT NULL,
	`ipmi_available`         integer         DEFAULT '0'               NOT NULL,
	`snmp_disable_until`     integer         DEFAULT '0'               NOT NULL,
	`snmp_available`         integer         DEFAULT '0'               NOT NULL,
	`maintenanceid`          bigint unsigned                           NULL,
	`maintenance_status`     integer         DEFAULT '0'               NOT NULL,
	`maintenance_type`       integer         DEFAULT '0'               NOT NULL,
	`maintenance_from`       integer         DEFAULT '0'               NOT NULL,
	`ipmi_errors_from`       integer         DEFAULT '0'               NOT NULL,
	`snmp_errors_from`       integer         DEFAULT '0'               NOT NULL,
	`ipmi_error`             varchar(2048)   DEFAULT ''                NOT NULL,
	`snmp_error`             varchar(2048)   DEFAULT ''                NOT NULL,
	`jmx_disable_until`      integer         DEFAULT '0'               NOT NULL,
	`jmx_available`          integer         DEFAULT '0'               NOT NULL,
	`jmx_errors_from`        integer         DEFAULT '0'               NOT NULL,
	`jmx_error`              varchar(2048)   DEFAULT ''                NOT NULL,
	`name`                   varchar(128)    DEFAULT ''                NOT NULL,
	`flags`                  integer         DEFAULT '0'               NOT NULL,
	`templateid`             bigint unsigned                           NULL,
	`description`            text                                      NOT NULL,
	`tls_connect`            integer         DEFAULT '1'               NOT NULL,
	`tls_accept`             integer         DEFAULT '1'               NOT NULL,
	`tls_issuer`             varchar(1024)   DEFAULT ''                NOT NULL,
	`tls_subject`            varchar(1024)   DEFAULT ''                NOT NULL,
	`tls_psk_identity`       varchar(128)    DEFAULT ''                NOT NULL,
	`tls_psk`                varchar(512)    DEFAULT ''                NOT NULL,
	`proxy_address`          varchar(255)    DEFAULT ''                NOT NULL,
	`auto_compress`          integer         DEFAULT '1'               NOT NULL,
	PRIMARY KEY (hostid)
) ENGINE=InnoDB;
CREATE INDEX `hosts_1` ON `hosts` (`host`);
CREATE INDEX `hosts_2` ON `hosts` (`status`);
CREATE INDEX `hosts_3` ON `hosts` (`proxy_hostid`);
CREATE INDEX `hosts_4` ON `hosts` (`name`);
CREATE INDEX `hosts_5` ON `hosts` (`maintenanceid`);
CREATE TABLE `hstgrp` (
	`groupid`                bigint unsigned                           NOT NULL,
	`name`                   varchar(255)    DEFAULT ''                NOT NULL,
	`internal`               integer         DEFAULT '0'               NOT NULL,
	`flags`                  integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (groupid)
) ENGINE=InnoDB;
CREATE INDEX `hstgrp_1` ON `hstgrp` (`name`);
CREATE TABLE `group_prototype` (
	`group_prototypeid`      bigint unsigned                           NOT NULL,
	`hostid`                 bigint unsigned                           NOT NULL,
	`name`                   varchar(255)    DEFAULT ''                NOT NULL,
	`groupid`                bigint unsigned                           NULL,
	`templateid`             bigint unsigned                           NULL,
	PRIMARY KEY (group_prototypeid)
) ENGINE=InnoDB;
CREATE INDEX `group_prototype_1` ON `group_prototype` (`hostid`);
CREATE TABLE `group_discovery` (
	`groupid`                bigint unsigned                           NOT NULL,
	`parent_group_prototypeid` bigint unsigned                           NOT NULL,
	`name`                   varchar(64)     DEFAULT ''                NOT NULL,
	`lastcheck`              integer         DEFAULT '0'               NOT NULL,
	`ts_delete`              integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (groupid)
) ENGINE=InnoDB;
CREATE TABLE `screens` (
	`screenid`               bigint unsigned                           NOT NULL,
	`name`                   varchar(255)                              NOT NULL,
	`hsize`                  integer         DEFAULT '1'               NOT NULL,
	`vsize`                  integer         DEFAULT '1'               NOT NULL,
	`templateid`             bigint unsigned                           NULL,
	`userid`                 bigint unsigned                           NULL,
	`private`                integer         DEFAULT '1'               NOT NULL,
	PRIMARY KEY (screenid)
) ENGINE=InnoDB;
CREATE INDEX `screens_1` ON `screens` (`templateid`);
CREATE TABLE `screens_items` (
	`screenitemid`           bigint unsigned                           NOT NULL,
	`screenid`               bigint unsigned                           NOT NULL,
	`resourcetype`           integer         DEFAULT '0'               NOT NULL,
	`resourceid`             bigint unsigned DEFAULT '0'               NOT NULL,
	`width`                  integer         DEFAULT '320'             NOT NULL,
	`height`                 integer         DEFAULT '200'             NOT NULL,
	`x`                      integer         DEFAULT '0'               NOT NULL,
	`y`                      integer         DEFAULT '0'               NOT NULL,
	`colspan`                integer         DEFAULT '1'               NOT NULL,
	`rowspan`                integer         DEFAULT '1'               NOT NULL,
	`elements`               integer         DEFAULT '25'              NOT NULL,
	`valign`                 integer         DEFAULT '0'               NOT NULL,
	`halign`                 integer         DEFAULT '0'               NOT NULL,
	`style`                  integer         DEFAULT '0'               NOT NULL,
	`url`                    varchar(255)    DEFAULT ''                NOT NULL,
	`dynamic`                integer         DEFAULT '0'               NOT NULL,
	`sort_triggers`          integer         DEFAULT '0'               NOT NULL,
	`application`            varchar(255)    DEFAULT ''                NOT NULL,
	`max_columns`            integer         DEFAULT '3'               NOT NULL,
	PRIMARY KEY (screenitemid)
) ENGINE=InnoDB;
CREATE INDEX `screens_items_1` ON `screens_items` (`screenid`);
CREATE TABLE `screen_user` (
	`screenuserid`           bigint unsigned                           NOT NULL,
	`screenid`               bigint unsigned                           NOT NULL,
	`userid`                 bigint unsigned                           NOT NULL,
	`permission`             integer         DEFAULT '2'               NOT NULL,
	PRIMARY KEY (screenuserid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `screen_user_1` ON `screen_user` (`screenid`,`userid`);
CREATE TABLE `screen_usrgrp` (
	`screenusrgrpid`         bigint unsigned                           NOT NULL,
	`screenid`               bigint unsigned                           NOT NULL,
	`usrgrpid`               bigint unsigned                           NOT NULL,
	`permission`             integer         DEFAULT '2'               NOT NULL,
	PRIMARY KEY (screenusrgrpid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `screen_usrgrp_1` ON `screen_usrgrp` (`screenid`,`usrgrpid`);
CREATE TABLE `slideshows` (
	`slideshowid`            bigint unsigned                           NOT NULL,
	`name`                   varchar(255)    DEFAULT ''                NOT NULL,
	`delay`                  varchar(32)     DEFAULT '30s'             NOT NULL,
	`userid`                 bigint unsigned                           NOT NULL,
	`private`                integer         DEFAULT '1'               NOT NULL,
	PRIMARY KEY (slideshowid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `slideshows_1` ON `slideshows` (`name`);
CREATE TABLE `slideshow_user` (
	`slideshowuserid`        bigint unsigned                           NOT NULL,
	`slideshowid`            bigint unsigned                           NOT NULL,
	`userid`                 bigint unsigned                           NOT NULL,
	`permission`             integer         DEFAULT '2'               NOT NULL,
	PRIMARY KEY (slideshowuserid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `slideshow_user_1` ON `slideshow_user` (`slideshowid`,`userid`);
CREATE TABLE `slideshow_usrgrp` (
	`slideshowusrgrpid`      bigint unsigned                           NOT NULL,
	`slideshowid`            bigint unsigned                           NOT NULL,
	`usrgrpid`               bigint unsigned                           NOT NULL,
	`permission`             integer         DEFAULT '2'               NOT NULL,
	PRIMARY KEY (slideshowusrgrpid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `slideshow_usrgrp_1` ON `slideshow_usrgrp` (`slideshowid`,`usrgrpid`);
CREATE TABLE `slides` (
	`slideid`                bigint unsigned                           NOT NULL,
	`slideshowid`            bigint unsigned                           NOT NULL,
	`screenid`               bigint unsigned                           NOT NULL,
	`step`                   integer         DEFAULT '0'               NOT NULL,
	`delay`                  varchar(32)     DEFAULT '0'               NOT NULL,
	PRIMARY KEY (slideid)
) ENGINE=InnoDB;
CREATE INDEX `slides_1` ON `slides` (`slideshowid`);
CREATE INDEX `slides_2` ON `slides` (`screenid`);
CREATE TABLE `drules` (
	`druleid`                bigint unsigned                           NOT NULL,
	`proxy_hostid`           bigint unsigned                           NULL,
	`name`                   varchar(255)    DEFAULT ''                NOT NULL,
	`iprange`                varchar(2048)   DEFAULT ''                NOT NULL,
	`delay`                  varchar(255)    DEFAULT '1h'              NOT NULL,
	`nextcheck`              integer         DEFAULT '0'               NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (druleid)
) ENGINE=InnoDB;
CREATE INDEX `drules_1` ON `drules` (`proxy_hostid`);
CREATE UNIQUE INDEX `drules_2` ON `drules` (`name`);
CREATE TABLE `dchecks` (
	`dcheckid`               bigint unsigned                           NOT NULL,
	`druleid`                bigint unsigned                           NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	`key_`                   varchar(512)    DEFAULT ''                NOT NULL,
	`snmp_community`         varchar(255)    DEFAULT ''                NOT NULL,
	`ports`                  varchar(255)    DEFAULT '0'               NOT NULL,
	`snmpv3_securityname`    varchar(64)     DEFAULT ''                NOT NULL,
	`snmpv3_securitylevel`   integer         DEFAULT '0'               NOT NULL,
	`snmpv3_authpassphrase`  varchar(64)     DEFAULT ''                NOT NULL,
	`snmpv3_privpassphrase`  varchar(64)     DEFAULT ''                NOT NULL,
	`uniq`                   integer         DEFAULT '0'               NOT NULL,
	`snmpv3_authprotocol`    integer         DEFAULT '0'               NOT NULL,
	`snmpv3_privprotocol`    integer         DEFAULT '0'               NOT NULL,
	`snmpv3_contextname`     varchar(255)    DEFAULT ''                NOT NULL,
	`host_source`            integer         DEFAULT '1'               NOT NULL,
	`name_source`            integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (dcheckid)
) ENGINE=InnoDB;
CREATE INDEX `dchecks_1` ON `dchecks` (`druleid`,`host_source`,`name_source`);
CREATE TABLE `applications` (
	`applicationid`          bigint unsigned                           NOT NULL,
	`hostid`                 bigint unsigned                           NOT NULL,
	`name`                   varchar(255)    DEFAULT ''                NOT NULL,
	`flags`                  integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (applicationid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `applications_2` ON `applications` (`hostid`,`name`);
CREATE TABLE `httptest` (
	`httptestid`             bigint unsigned                           NOT NULL,
	`name`                   varchar(64)     DEFAULT ''                NOT NULL,
	`applicationid`          bigint unsigned                           NULL,
	`nextcheck`              integer         DEFAULT '0'               NOT NULL,
	`delay`                  varchar(255)    DEFAULT '1m'              NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	`agent`                  varchar(255)    DEFAULT 'Zabbix'          NOT NULL,
	`authentication`         integer         DEFAULT '0'               NOT NULL,
	`http_user`              varchar(64)     DEFAULT ''                NOT NULL,
	`http_password`          varchar(64)     DEFAULT ''                NOT NULL,
	`hostid`                 bigint unsigned                           NOT NULL,
	`templateid`             bigint unsigned                           NULL,
	`http_proxy`             varchar(255)    DEFAULT ''                NOT NULL,
	`retries`                integer         DEFAULT '1'               NOT NULL,
	`ssl_cert_file`          varchar(255)    DEFAULT ''                NOT NULL,
	`ssl_key_file`           varchar(255)    DEFAULT ''                NOT NULL,
	`ssl_key_password`       varchar(64)     DEFAULT ''                NOT NULL,
	`verify_peer`            integer         DEFAULT '0'               NOT NULL,
	`verify_host`            integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (httptestid)
) ENGINE=InnoDB;
CREATE INDEX `httptest_1` ON `httptest` (`applicationid`);
CREATE UNIQUE INDEX `httptest_2` ON `httptest` (`hostid`,`name`);
CREATE INDEX `httptest_3` ON `httptest` (`status`);
CREATE INDEX `httptest_4` ON `httptest` (`templateid`);
CREATE TABLE `httpstep` (
	`httpstepid`             bigint unsigned                           NOT NULL,
	`httptestid`             bigint unsigned                           NOT NULL,
	`name`                   varchar(64)     DEFAULT ''                NOT NULL,
	`no`                     integer         DEFAULT '0'               NOT NULL,
	`url`                    varchar(2048)   DEFAULT ''                NOT NULL,
	`timeout`                varchar(255)    DEFAULT '15s'             NOT NULL,
	`posts`                  text                                      NOT NULL,
	`required`               varchar(255)    DEFAULT ''                NOT NULL,
	`status_codes`           varchar(255)    DEFAULT ''                NOT NULL,
	`follow_redirects`       integer         DEFAULT '1'               NOT NULL,
	`retrieve_mode`          integer         DEFAULT '0'               NOT NULL,
	`post_type`              integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (httpstepid)
) ENGINE=InnoDB;
CREATE INDEX `httpstep_1` ON `httpstep` (`httptestid`);
CREATE TABLE `interface` (
	`interfaceid`            bigint unsigned                           NOT NULL,
	`hostid`                 bigint unsigned                           NOT NULL,
	`main`                   integer         DEFAULT '0'               NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	`useip`                  integer         DEFAULT '1'               NOT NULL,
	`ip`                     varchar(64)     DEFAULT '127.0.0.1'       NOT NULL,
	`dns`                    varchar(255)    DEFAULT ''                NOT NULL,
	`port`                   varchar(64)     DEFAULT '10050'           NOT NULL,
	`bulk`                   integer         DEFAULT '1'               NOT NULL,
	PRIMARY KEY (interfaceid)
) ENGINE=InnoDB;
CREATE INDEX `interface_1` ON `interface` (`hostid`,`type`);
CREATE INDEX `interface_2` ON `interface` (`ip`,`dns`);
CREATE TABLE `valuemaps` (
	`valuemapid`             bigint unsigned                           NOT NULL,
	`name`                   varchar(64)     DEFAULT ''                NOT NULL,
	PRIMARY KEY (valuemapid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `valuemaps_1` ON `valuemaps` (`name`);
CREATE TABLE `items` (
	`itemid`                 bigint unsigned                           NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	`snmp_community`         varchar(64)     DEFAULT ''                NOT NULL,
	`snmp_oid`               varchar(512)    DEFAULT ''                NOT NULL,
	`hostid`                 bigint unsigned                           NOT NULL,
	`name`                   varchar(255)    DEFAULT ''                NOT NULL,
	`key_`                   varchar(255)    DEFAULT ''                NOT NULL,
	`delay`                  varchar(1024)   DEFAULT '0'               NOT NULL,
	`history`                varchar(255)    DEFAULT '90d'             NOT NULL,
	`trends`                 varchar(255)    DEFAULT '365d'            NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	`value_type`             integer         DEFAULT '0'               NOT NULL,
	`trapper_hosts`          varchar(255)    DEFAULT ''                NOT NULL,
	`units`                  varchar(255)    DEFAULT ''                NOT NULL,
	`snmpv3_securityname`    varchar(64)     DEFAULT ''                NOT NULL,
	`snmpv3_securitylevel`   integer         DEFAULT '0'               NOT NULL,
	`snmpv3_authpassphrase`  varchar(64)     DEFAULT ''                NOT NULL,
	`snmpv3_privpassphrase`  varchar(64)     DEFAULT ''                NOT NULL,
	`formula`                varchar(255)    DEFAULT ''                NOT NULL,
	`error`                  varchar(2048)   DEFAULT ''                NOT NULL,
	`lastlogsize`            bigint unsigned DEFAULT '0'               NOT NULL,
	`logtimefmt`             varchar(64)     DEFAULT ''                NOT NULL,
	`templateid`             bigint unsigned                           NULL,
	`valuemapid`             bigint unsigned                           NULL,
	`params`                 text                                      NOT NULL,
	`ipmi_sensor`            varchar(128)    DEFAULT ''                NOT NULL,
	`authtype`               integer         DEFAULT '0'               NOT NULL,
	`username`               varchar(64)     DEFAULT ''                NOT NULL,
	`password`               varchar(64)     DEFAULT ''                NOT NULL,
	`publickey`              varchar(64)     DEFAULT ''                NOT NULL,
	`privatekey`             varchar(64)     DEFAULT ''                NOT NULL,
	`mtime`                  integer         DEFAULT '0'               NOT NULL,
	`flags`                  integer         DEFAULT '0'               NOT NULL,
	`interfaceid`            bigint unsigned                           NULL,
	`port`                   varchar(64)     DEFAULT ''                NOT NULL,
	`description`            text                                      NOT NULL,
	`inventory_link`         integer         DEFAULT '0'               NOT NULL,
	`lifetime`               varchar(255)    DEFAULT '30d'             NOT NULL,
	`snmpv3_authprotocol`    integer         DEFAULT '0'               NOT NULL,
	`snmpv3_privprotocol`    integer         DEFAULT '0'               NOT NULL,
	`state`                  integer         DEFAULT '0'               NOT NULL,
	`snmpv3_contextname`     varchar(255)    DEFAULT ''                NOT NULL,
	`evaltype`               integer         DEFAULT '0'               NOT NULL,
	`jmx_endpoint`           varchar(255)    DEFAULT ''                NOT NULL,
	`master_itemid`          bigint unsigned                           NULL,
	`timeout`                varchar(255)    DEFAULT '3s'              NOT NULL,
	`url`                    varchar(2048)   DEFAULT ''                NOT NULL,
	`query_fields`           varchar(2048)   DEFAULT ''                NOT NULL,
	`posts`                  text                                      NOT NULL,
	`status_codes`           varchar(255)    DEFAULT '200'             NOT NULL,
	`follow_redirects`       integer         DEFAULT '1'               NOT NULL,
	`post_type`              integer         DEFAULT '0'               NOT NULL,
	`http_proxy`             varchar(255)    DEFAULT ''                NOT NULL,
	`headers`                text                                      NOT NULL,
	`retrieve_mode`          integer         DEFAULT '0'               NOT NULL,
	`request_method`         integer         DEFAULT '0'               NOT NULL,
	`output_format`          integer         DEFAULT '0'               NOT NULL,
	`ssl_cert_file`          varchar(255)    DEFAULT ''                NOT NULL,
	`ssl_key_file`           varchar(255)    DEFAULT ''                NOT NULL,
	`ssl_key_password`       varchar(64)     DEFAULT ''                NOT NULL,
	`verify_peer`            integer         DEFAULT '0'               NOT NULL,
	`verify_host`            integer         DEFAULT '0'               NOT NULL,
	`allow_traps`            integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (itemid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `items_1` ON `items` (`hostid`,`key_`);
CREATE INDEX `items_3` ON `items` (`status`);
CREATE INDEX `items_4` ON `items` (`templateid`);
CREATE INDEX `items_5` ON `items` (`valuemapid`);
CREATE INDEX `items_6` ON `items` (`interfaceid`);
CREATE INDEX `items_7` ON `items` (`master_itemid`);
CREATE TABLE `httpstepitem` (
	`httpstepitemid`         bigint unsigned                           NOT NULL,
	`httpstepid`             bigint unsigned                           NOT NULL,
	`itemid`                 bigint unsigned                           NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (httpstepitemid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `httpstepitem_1` ON `httpstepitem` (`httpstepid`,`itemid`);
CREATE INDEX `httpstepitem_2` ON `httpstepitem` (`itemid`);
CREATE TABLE `httptestitem` (
	`httptestitemid`         bigint unsigned                           NOT NULL,
	`httptestid`             bigint unsigned                           NOT NULL,
	`itemid`                 bigint unsigned                           NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (httptestitemid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `httptestitem_1` ON `httptestitem` (`httptestid`,`itemid`);
CREATE INDEX `httptestitem_2` ON `httptestitem` (`itemid`);
CREATE TABLE `media_type` (
	`mediatypeid`            bigint unsigned                           NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	`description`            varchar(100)    DEFAULT ''                NOT NULL,
	`smtp_server`            varchar(255)    DEFAULT ''                NOT NULL,
	`smtp_helo`              varchar(255)    DEFAULT ''                NOT NULL,
	`smtp_email`             varchar(255)    DEFAULT ''                NOT NULL,
	`exec_path`              varchar(255)    DEFAULT ''                NOT NULL,
	`gsm_modem`              varchar(255)    DEFAULT ''                NOT NULL,
	`username`               varchar(255)    DEFAULT ''                NOT NULL,
	`passwd`                 varchar(255)    DEFAULT ''                NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	`smtp_port`              integer         DEFAULT '25'              NOT NULL,
	`smtp_security`          integer         DEFAULT '0'               NOT NULL,
	`smtp_verify_peer`       integer         DEFAULT '0'               NOT NULL,
	`smtp_verify_host`       integer         DEFAULT '0'               NOT NULL,
	`smtp_authentication`    integer         DEFAULT '0'               NOT NULL,
	`exec_params`            varchar(255)    DEFAULT ''                NOT NULL,
	`maxsessions`            integer         DEFAULT '1'               NOT NULL,
	`maxattempts`            integer         DEFAULT '3'               NOT NULL,
	`attempt_interval`       varchar(32)     DEFAULT '10s'             NOT NULL,
	`content_type`           integer         DEFAULT '1'               NOT NULL,
	PRIMARY KEY (mediatypeid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `media_type_1` ON `media_type` (`description`);
CREATE TABLE `usrgrp` (
	`usrgrpid`               bigint unsigned                           NOT NULL,
	`name`                   varchar(64)     DEFAULT ''                NOT NULL,
	`gui_access`             integer         DEFAULT '0'               NOT NULL,
	`users_status`           integer         DEFAULT '0'               NOT NULL,
	`debug_mode`             integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (usrgrpid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `usrgrp_1` ON `usrgrp` (`name`);
CREATE TABLE `users_groups` (
	`id`                     bigint unsigned                           NOT NULL,
	`usrgrpid`               bigint unsigned                           NOT NULL,
	`userid`                 bigint unsigned                           NOT NULL,
	PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `users_groups_1` ON `users_groups` (`usrgrpid`,`userid`);
CREATE INDEX `users_groups_2` ON `users_groups` (`userid`);
CREATE TABLE `scripts` (
	`scriptid`               bigint unsigned                           NOT NULL,
	`name`                   varchar(255)    DEFAULT ''                NOT NULL,
	`command`                varchar(255)    DEFAULT ''                NOT NULL,
	`host_access`            integer         DEFAULT '2'               NOT NULL,
	`usrgrpid`               bigint unsigned                           NULL,
	`groupid`                bigint unsigned                           NULL,
	`description`            text                                      NOT NULL,
	`confirmation`           varchar(255)    DEFAULT ''                NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	`execute_on`             integer         DEFAULT '2'               NOT NULL,
	PRIMARY KEY (scriptid)
) ENGINE=InnoDB;
CREATE INDEX `scripts_1` ON `scripts` (`usrgrpid`);
CREATE INDEX `scripts_2` ON `scripts` (`groupid`);
CREATE UNIQUE INDEX `scripts_3` ON `scripts` (`name`);
CREATE TABLE `actions` (
	`actionid`               bigint unsigned                           NOT NULL,
	`name`                   varchar(255)    DEFAULT ''                NOT NULL,
	`eventsource`            integer         DEFAULT '0'               NOT NULL,
	`evaltype`               integer         DEFAULT '0'               NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	`esc_period`             varchar(255)    DEFAULT '1h'              NOT NULL,
	`def_shortdata`          varchar(255)    DEFAULT ''                NOT NULL,
	`def_longdata`           text                                      NOT NULL,
	`r_shortdata`            varchar(255)    DEFAULT ''                NOT NULL,
	`r_longdata`             text                                      NOT NULL,
	`formula`                varchar(255)    DEFAULT ''                NOT NULL,
	`pause_suppressed`       integer         DEFAULT '1'               NOT NULL,
	`ack_shortdata`          varchar(255)    DEFAULT ''                NOT NULL,
	`ack_longdata`           text                                      NOT NULL,
	PRIMARY KEY (actionid)
) ENGINE=InnoDB;
CREATE INDEX `actions_1` ON `actions` (`eventsource`,`status`);
CREATE UNIQUE INDEX `actions_2` ON `actions` (`name`);
CREATE TABLE `operations` (
	`operationid`            bigint unsigned                           NOT NULL,
	`actionid`               bigint unsigned                           NOT NULL,
	`operationtype`          integer         DEFAULT '0'               NOT NULL,
	`esc_period`             varchar(255)    DEFAULT '0'               NOT NULL,
	`esc_step_from`          integer         DEFAULT '1'               NOT NULL,
	`esc_step_to`            integer         DEFAULT '1'               NOT NULL,
	`evaltype`               integer         DEFAULT '0'               NOT NULL,
	`recovery`               integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (operationid)
) ENGINE=InnoDB;
CREATE INDEX `operations_1` ON `operations` (`actionid`);
CREATE TABLE `opmessage` (
	`operationid`            bigint unsigned                           NOT NULL,
	`default_msg`            integer         DEFAULT '0'               NOT NULL,
	`subject`                varchar(255)    DEFAULT ''                NOT NULL,
	`message`                text                                      NOT NULL,
	`mediatypeid`            bigint unsigned                           NULL,
	PRIMARY KEY (operationid)
) ENGINE=InnoDB;
CREATE INDEX `opmessage_1` ON `opmessage` (`mediatypeid`);
CREATE TABLE `opmessage_grp` (
	`opmessage_grpid`        bigint unsigned                           NOT NULL,
	`operationid`            bigint unsigned                           NOT NULL,
	`usrgrpid`               bigint unsigned                           NOT NULL,
	PRIMARY KEY (opmessage_grpid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `opmessage_grp_1` ON `opmessage_grp` (`operationid`,`usrgrpid`);
CREATE INDEX `opmessage_grp_2` ON `opmessage_grp` (`usrgrpid`);
CREATE TABLE `opmessage_usr` (
	`opmessage_usrid`        bigint unsigned                           NOT NULL,
	`operationid`            bigint unsigned                           NOT NULL,
	`userid`                 bigint unsigned                           NOT NULL,
	PRIMARY KEY (opmessage_usrid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `opmessage_usr_1` ON `opmessage_usr` (`operationid`,`userid`);
CREATE INDEX `opmessage_usr_2` ON `opmessage_usr` (`userid`);
CREATE TABLE `opcommand` (
	`operationid`            bigint unsigned                           NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	`scriptid`               bigint unsigned                           NULL,
	`execute_on`             integer         DEFAULT '0'               NOT NULL,
	`port`                   varchar(64)     DEFAULT ''                NOT NULL,
	`authtype`               integer         DEFAULT '0'               NOT NULL,
	`username`               varchar(64)     DEFAULT ''                NOT NULL,
	`password`               varchar(64)     DEFAULT ''                NOT NULL,
	`publickey`              varchar(64)     DEFAULT ''                NOT NULL,
	`privatekey`             varchar(64)     DEFAULT ''                NOT NULL,
	`command`                text                                      NOT NULL,
	PRIMARY KEY (operationid)
) ENGINE=InnoDB;
CREATE INDEX `opcommand_1` ON `opcommand` (`scriptid`);
CREATE TABLE `opcommand_hst` (
	`opcommand_hstid`        bigint unsigned                           NOT NULL,
	`operationid`            bigint unsigned                           NOT NULL,
	`hostid`                 bigint unsigned                           NULL,
	PRIMARY KEY (opcommand_hstid)
) ENGINE=InnoDB;
CREATE INDEX `opcommand_hst_1` ON `opcommand_hst` (`operationid`);
CREATE INDEX `opcommand_hst_2` ON `opcommand_hst` (`hostid`);
CREATE TABLE `opcommand_grp` (
	`opcommand_grpid`        bigint unsigned                           NOT NULL,
	`operationid`            bigint unsigned                           NOT NULL,
	`groupid`                bigint unsigned                           NOT NULL,
	PRIMARY KEY (opcommand_grpid)
) ENGINE=InnoDB;
CREATE INDEX `opcommand_grp_1` ON `opcommand_grp` (`operationid`);
CREATE INDEX `opcommand_grp_2` ON `opcommand_grp` (`groupid`);
CREATE TABLE `opgroup` (
	`opgroupid`              bigint unsigned                           NOT NULL,
	`operationid`            bigint unsigned                           NOT NULL,
	`groupid`                bigint unsigned                           NOT NULL,
	PRIMARY KEY (opgroupid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `opgroup_1` ON `opgroup` (`operationid`,`groupid`);
CREATE INDEX `opgroup_2` ON `opgroup` (`groupid`);
CREATE TABLE `optemplate` (
	`optemplateid`           bigint unsigned                           NOT NULL,
	`operationid`            bigint unsigned                           NOT NULL,
	`templateid`             bigint unsigned                           NOT NULL,
	PRIMARY KEY (optemplateid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `optemplate_1` ON `optemplate` (`operationid`,`templateid`);
CREATE INDEX `optemplate_2` ON `optemplate` (`templateid`);
CREATE TABLE `opconditions` (
	`opconditionid`          bigint unsigned                           NOT NULL,
	`operationid`            bigint unsigned                           NOT NULL,
	`conditiontype`          integer         DEFAULT '0'               NOT NULL,
	`operator`               integer         DEFAULT '0'               NOT NULL,
	`value`                  varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (opconditionid)
) ENGINE=InnoDB;
CREATE INDEX `opconditions_1` ON `opconditions` (`operationid`);
CREATE TABLE `conditions` (
	`conditionid`            bigint unsigned                           NOT NULL,
	`actionid`               bigint unsigned                           NOT NULL,
	`conditiontype`          integer         DEFAULT '0'               NOT NULL,
	`operator`               integer         DEFAULT '0'               NOT NULL,
	`value`                  varchar(255)    DEFAULT ''                NOT NULL,
	`value2`                 varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (conditionid)
) ENGINE=InnoDB;
CREATE INDEX `conditions_1` ON `conditions` (`actionid`);
CREATE TABLE `config` (
	`configid`               bigint unsigned                           NOT NULL,
	`refresh_unsupported`    varchar(32)     DEFAULT '10m'             NOT NULL,
	`work_period`            varchar(255)    DEFAULT '1-5,09:00-18:00' NOT NULL,
	`alert_usrgrpid`         bigint unsigned                           NULL,
	`default_theme`          varchar(128)    DEFAULT 'blue-theme'      NOT NULL,
	`authentication_type`    integer         DEFAULT '0'               NOT NULL,
	`ldap_host`              varchar(255)    DEFAULT ''                NOT NULL,
	`ldap_port`              integer         DEFAULT 389               NOT NULL,
	`ldap_base_dn`           varchar(255)    DEFAULT ''                NOT NULL,
	`ldap_bind_dn`           varchar(255)    DEFAULT ''                NOT NULL,
	`ldap_bind_password`     varchar(128)    DEFAULT ''                NOT NULL,
	`ldap_search_attribute`  varchar(128)    DEFAULT ''                NOT NULL,
	`dropdown_first_entry`   integer         DEFAULT '1'               NOT NULL,
	`dropdown_first_remember` integer         DEFAULT '1'               NOT NULL,
	`discovery_groupid`      bigint unsigned                           NOT NULL,
	`max_in_table`           integer         DEFAULT '50'              NOT NULL,
	`search_limit`           integer         DEFAULT '1000'            NOT NULL,
	`severity_color_0`       varchar(6)      DEFAULT '97AAB3'          NOT NULL,
	`severity_color_1`       varchar(6)      DEFAULT '7499FF'          NOT NULL,
	`severity_color_2`       varchar(6)      DEFAULT 'FFC859'          NOT NULL,
	`severity_color_3`       varchar(6)      DEFAULT 'FFA059'          NOT NULL,
	`severity_color_4`       varchar(6)      DEFAULT 'E97659'          NOT NULL,
	`severity_color_5`       varchar(6)      DEFAULT 'E45959'          NOT NULL,
	`severity_name_0`        varchar(32)     DEFAULT 'Not classified'  NOT NULL,
	`severity_name_1`        varchar(32)     DEFAULT 'Information'     NOT NULL,
	`severity_name_2`        varchar(32)     DEFAULT 'Warning'         NOT NULL,
	`severity_name_3`        varchar(32)     DEFAULT 'Average'         NOT NULL,
	`severity_name_4`        varchar(32)     DEFAULT 'High'            NOT NULL,
	`severity_name_5`        varchar(32)     DEFAULT 'Disaster'        NOT NULL,
	`ok_period`              varchar(32)     DEFAULT '5m'              NOT NULL,
	`blink_period`           varchar(32)     DEFAULT '2m'              NOT NULL,
	`problem_unack_color`    varchar(6)      DEFAULT 'CC0000'          NOT NULL,
	`problem_ack_color`      varchar(6)      DEFAULT 'CC0000'          NOT NULL,
	`ok_unack_color`         varchar(6)      DEFAULT '009900'          NOT NULL,
	`ok_ack_color`           varchar(6)      DEFAULT '009900'          NOT NULL,
	`problem_unack_style`    integer         DEFAULT '1'               NOT NULL,
	`problem_ack_style`      integer         DEFAULT '1'               NOT NULL,
	`ok_unack_style`         integer         DEFAULT '1'               NOT NULL,
	`ok_ack_style`           integer         DEFAULT '1'               NOT NULL,
	`snmptrap_logging`       integer         DEFAULT '1'               NOT NULL,
	`server_check_interval`  integer         DEFAULT '10'              NOT NULL,
	`hk_events_mode`         integer         DEFAULT '1'               NOT NULL,
	`hk_events_trigger`      varchar(32)     DEFAULT '365d'            NOT NULL,
	`hk_events_internal`     varchar(32)     DEFAULT '1d'              NOT NULL,
	`hk_events_discovery`    varchar(32)     DEFAULT '1d'              NOT NULL,
	`hk_events_autoreg`      varchar(32)     DEFAULT '1d'              NOT NULL,
	`hk_services_mode`       integer         DEFAULT '1'               NOT NULL,
	`hk_services`            varchar(32)     DEFAULT '365d'            NOT NULL,
	`hk_audit_mode`          integer         DEFAULT '1'               NOT NULL,
	`hk_audit`               varchar(32)     DEFAULT '365d'            NOT NULL,
	`hk_sessions_mode`       integer         DEFAULT '1'               NOT NULL,
	`hk_sessions`            varchar(32)     DEFAULT '365d'            NOT NULL,
	`hk_history_mode`        integer         DEFAULT '1'               NOT NULL,
	`hk_history_global`      integer         DEFAULT '0'               NOT NULL,
	`hk_history`             varchar(32)     DEFAULT '90d'             NOT NULL,
	`hk_trends_mode`         integer         DEFAULT '1'               NOT NULL,
	`hk_trends_global`       integer         DEFAULT '0'               NOT NULL,
	`hk_trends`              varchar(32)     DEFAULT '365d'            NOT NULL,
	`default_inventory_mode` integer         DEFAULT '-1'              NOT NULL,
	`custom_color`           integer         DEFAULT '0'               NOT NULL,
	`http_auth_enabled`      integer         DEFAULT '0'               NOT NULL,
	`http_login_form`        integer         DEFAULT '0'               NOT NULL,
	`http_strip_domains`     varchar(2048)   DEFAULT ''                NOT NULL,
	`http_case_sensitive`    integer         DEFAULT '1'               NOT NULL,
	`ldap_configured`        integer         DEFAULT '0'               NOT NULL,
	`ldap_case_sensitive`    integer         DEFAULT '1'               NOT NULL,
	`db_extension`           varchar(32)     DEFAULT ''                NOT NULL,
	PRIMARY KEY (configid)
) ENGINE=InnoDB;
CREATE INDEX `config_1` ON `config` (`alert_usrgrpid`);
CREATE INDEX `config_2` ON `config` (`discovery_groupid`);
CREATE TABLE `triggers` (
	`triggerid`              bigint unsigned                           NOT NULL,
	`expression`             varchar(2048)   DEFAULT ''                NOT NULL,
	`description`            varchar(255)    DEFAULT ''                NOT NULL,
	`url`                    varchar(255)    DEFAULT ''                NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	`value`                  integer         DEFAULT '0'               NOT NULL,
	`priority`               integer         DEFAULT '0'               NOT NULL,
	`lastchange`             integer         DEFAULT '0'               NOT NULL,
	`comments`               text                                      NOT NULL,
	`error`                  varchar(2048)   DEFAULT ''                NOT NULL,
	`templateid`             bigint unsigned                           NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	`state`                  integer         DEFAULT '0'               NOT NULL,
	`flags`                  integer         DEFAULT '0'               NOT NULL,
	`recovery_mode`          integer         DEFAULT '0'               NOT NULL,
	`recovery_expression`    varchar(2048)   DEFAULT ''                NOT NULL,
	`correlation_mode`       integer         DEFAULT '0'               NOT NULL,
	`correlation_tag`        varchar(255)    DEFAULT ''                NOT NULL,
	`manual_close`           integer         DEFAULT '0'               NOT NULL,
	`details`                varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (triggerid)
) ENGINE=InnoDB;
CREATE INDEX `triggers_1` ON `triggers` (`status`);
CREATE INDEX `triggers_2` ON `triggers` (`value`,`lastchange`);
CREATE INDEX `triggers_3` ON `triggers` (`templateid`);
CREATE TABLE `trigger_depends` (
	`triggerdepid`           bigint unsigned                           NOT NULL,
	`triggerid_down`         bigint unsigned                           NOT NULL,
	`triggerid_up`           bigint unsigned                           NOT NULL,
	PRIMARY KEY (triggerdepid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `trigger_depends_1` ON `trigger_depends` (`triggerid_down`,`triggerid_up`);
CREATE INDEX `trigger_depends_2` ON `trigger_depends` (`triggerid_up`);
CREATE TABLE `functions` (
	`functionid`             bigint unsigned                           NOT NULL,
	`itemid`                 bigint unsigned                           NOT NULL,
	`triggerid`              bigint unsigned                           NOT NULL,
	`name`                   varchar(12)     DEFAULT ''                NOT NULL,
	`parameter`              varchar(255)    DEFAULT '0'               NOT NULL,
	PRIMARY KEY (functionid)
) ENGINE=InnoDB;
CREATE INDEX `functions_1` ON `functions` (`triggerid`);
CREATE INDEX `functions_2` ON `functions` (`itemid`,`name`,`parameter`);
CREATE TABLE `graphs` (
	`graphid`                bigint unsigned                           NOT NULL,
	`name`                   varchar(128)    DEFAULT ''                NOT NULL,
	`width`                  integer         DEFAULT '900'             NOT NULL,
	`height`                 integer         DEFAULT '200'             NOT NULL,
	`yaxismin`               double(16,4)    DEFAULT '0'               NOT NULL,
	`yaxismax`               double(16,4)    DEFAULT '100'             NOT NULL,
	`templateid`             bigint unsigned                           NULL,
	`show_work_period`       integer         DEFAULT '1'               NOT NULL,
	`show_triggers`          integer         DEFAULT '1'               NOT NULL,
	`graphtype`              integer         DEFAULT '0'               NOT NULL,
	`show_legend`            integer         DEFAULT '1'               NOT NULL,
	`show_3d`                integer         DEFAULT '0'               NOT NULL,
	`percent_left`           double(16,4)    DEFAULT '0'               NOT NULL,
	`percent_right`          double(16,4)    DEFAULT '0'               NOT NULL,
	`ymin_type`              integer         DEFAULT '0'               NOT NULL,
	`ymax_type`              integer         DEFAULT '0'               NOT NULL,
	`ymin_itemid`            bigint unsigned                           NULL,
	`ymax_itemid`            bigint unsigned                           NULL,
	`flags`                  integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (graphid)
) ENGINE=InnoDB;
CREATE INDEX `graphs_1` ON `graphs` (`name`);
CREATE INDEX `graphs_2` ON `graphs` (`templateid`);
CREATE INDEX `graphs_3` ON `graphs` (`ymin_itemid`);
CREATE INDEX `graphs_4` ON `graphs` (`ymax_itemid`);
CREATE TABLE `graphs_items` (
	`gitemid`                bigint unsigned                           NOT NULL,
	`graphid`                bigint unsigned                           NOT NULL,
	`itemid`                 bigint unsigned                           NOT NULL,
	`drawtype`               integer         DEFAULT '0'               NOT NULL,
	`sortorder`              integer         DEFAULT '0'               NOT NULL,
	`color`                  varchar(6)      DEFAULT '009600'          NOT NULL,
	`yaxisside`              integer         DEFAULT '0'               NOT NULL,
	`calc_fnc`               integer         DEFAULT '2'               NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (gitemid)
) ENGINE=InnoDB;
CREATE INDEX `graphs_items_1` ON `graphs_items` (`itemid`);
CREATE INDEX `graphs_items_2` ON `graphs_items` (`graphid`);
CREATE TABLE `graph_theme` (
	`graphthemeid`           bigint unsigned                           NOT NULL,
	`theme`                  varchar(64)     DEFAULT ''                NOT NULL,
	`backgroundcolor`        varchar(6)      DEFAULT ''                NOT NULL,
	`graphcolor`             varchar(6)      DEFAULT ''                NOT NULL,
	`gridcolor`              varchar(6)      DEFAULT ''                NOT NULL,
	`maingridcolor`          varchar(6)      DEFAULT ''                NOT NULL,
	`gridbordercolor`        varchar(6)      DEFAULT ''                NOT NULL,
	`textcolor`              varchar(6)      DEFAULT ''                NOT NULL,
	`highlightcolor`         varchar(6)      DEFAULT ''                NOT NULL,
	`leftpercentilecolor`    varchar(6)      DEFAULT ''                NOT NULL,
	`rightpercentilecolor`   varchar(6)      DEFAULT ''                NOT NULL,
	`nonworktimecolor`       varchar(6)      DEFAULT ''                NOT NULL,
	`colorpalette`           varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (graphthemeid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `graph_theme_1` ON `graph_theme` (`theme`);
CREATE TABLE `globalmacro` (
	`globalmacroid`          bigint unsigned                           NOT NULL,
	`macro`                  varchar(255)    DEFAULT ''                NOT NULL,
	`value`                  varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (globalmacroid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `globalmacro_1` ON `globalmacro` (`macro`);
CREATE TABLE `hostmacro` (
	`hostmacroid`            bigint unsigned                           NOT NULL,
	`hostid`                 bigint unsigned                           NOT NULL,
	`macro`                  varchar(255)    DEFAULT ''                NOT NULL,
	`value`                  varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (hostmacroid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `hostmacro_1` ON `hostmacro` (`hostid`,`macro`);
CREATE TABLE `hosts_groups` (
	`hostgroupid`            bigint unsigned                           NOT NULL,
	`hostid`                 bigint unsigned                           NOT NULL,
	`groupid`                bigint unsigned                           NOT NULL,
	PRIMARY KEY (hostgroupid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `hosts_groups_1` ON `hosts_groups` (`hostid`,`groupid`);
CREATE INDEX `hosts_groups_2` ON `hosts_groups` (`groupid`);
CREATE TABLE `hosts_templates` (
	`hosttemplateid`         bigint unsigned                           NOT NULL,
	`hostid`                 bigint unsigned                           NOT NULL,
	`templateid`             bigint unsigned                           NOT NULL,
	PRIMARY KEY (hosttemplateid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `hosts_templates_1` ON `hosts_templates` (`hostid`,`templateid`);
CREATE INDEX `hosts_templates_2` ON `hosts_templates` (`templateid`);
CREATE TABLE `items_applications` (
	`itemappid`              bigint unsigned                           NOT NULL,
	`applicationid`          bigint unsigned                           NOT NULL,
	`itemid`                 bigint unsigned                           NOT NULL,
	PRIMARY KEY (itemappid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `items_applications_1` ON `items_applications` (`applicationid`,`itemid`);
CREATE INDEX `items_applications_2` ON `items_applications` (`itemid`);
CREATE TABLE `mappings` (
	`mappingid`              bigint unsigned                           NOT NULL,
	`valuemapid`             bigint unsigned                           NOT NULL,
	`value`                  varchar(64)     DEFAULT ''                NOT NULL,
	`newvalue`               varchar(64)     DEFAULT ''                NOT NULL,
	PRIMARY KEY (mappingid)
) ENGINE=InnoDB;
CREATE INDEX `mappings_1` ON `mappings` (`valuemapid`);
CREATE TABLE `media` (
	`mediaid`                bigint unsigned                           NOT NULL,
	`userid`                 bigint unsigned                           NOT NULL,
	`mediatypeid`            bigint unsigned                           NOT NULL,
	`sendto`                 varchar(1024)   DEFAULT ''                NOT NULL,
	`active`                 integer         DEFAULT '0'               NOT NULL,
	`severity`               integer         DEFAULT '63'              NOT NULL,
	`period`                 varchar(1024)   DEFAULT '1-7,00:00-24:00' NOT NULL,
	PRIMARY KEY (mediaid)
) ENGINE=InnoDB;
CREATE INDEX `media_1` ON `media` (`userid`);
CREATE INDEX `media_2` ON `media` (`mediatypeid`);
CREATE TABLE `rights` (
	`rightid`                bigint unsigned                           NOT NULL,
	`groupid`                bigint unsigned                           NOT NULL,
	`permission`             integer         DEFAULT '0'               NOT NULL,
	`id`                     bigint unsigned                           NOT NULL,
	PRIMARY KEY (rightid)
) ENGINE=InnoDB;
CREATE INDEX `rights_1` ON `rights` (`groupid`);
CREATE INDEX `rights_2` ON `rights` (`id`);
CREATE TABLE `services` (
	`serviceid`              bigint unsigned                           NOT NULL,
	`name`                   varchar(128)    DEFAULT ''                NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	`algorithm`              integer         DEFAULT '0'               NOT NULL,
	`triggerid`              bigint unsigned                           NULL,
	`showsla`                integer         DEFAULT '0'               NOT NULL,
	`goodsla`                double(16,4)    DEFAULT '99.9'            NOT NULL,
	`sortorder`              integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (serviceid)
) ENGINE=InnoDB;
CREATE INDEX `services_1` ON `services` (`triggerid`);
CREATE TABLE `services_links` (
	`linkid`                 bigint unsigned                           NOT NULL,
	`serviceupid`            bigint unsigned                           NOT NULL,
	`servicedownid`          bigint unsigned                           NOT NULL,
	`soft`                   integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (linkid)
) ENGINE=InnoDB;
CREATE INDEX `services_links_1` ON `services_links` (`servicedownid`);
CREATE UNIQUE INDEX `services_links_2` ON `services_links` (`serviceupid`,`servicedownid`);
CREATE TABLE `services_times` (
	`timeid`                 bigint unsigned                           NOT NULL,
	`serviceid`              bigint unsigned                           NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	`ts_from`                integer         DEFAULT '0'               NOT NULL,
	`ts_to`                  integer         DEFAULT '0'               NOT NULL,
	`note`                   varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (timeid)
) ENGINE=InnoDB;
CREATE INDEX `services_times_1` ON `services_times` (`serviceid`,`type`,`ts_from`,`ts_to`);
CREATE TABLE `icon_map` (
	`iconmapid`              bigint unsigned                           NOT NULL,
	`name`                   varchar(64)     DEFAULT ''                NOT NULL,
	`default_iconid`         bigint unsigned                           NOT NULL,
	PRIMARY KEY (iconmapid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `icon_map_1` ON `icon_map` (`name`);
CREATE INDEX `icon_map_2` ON `icon_map` (`default_iconid`);
CREATE TABLE `icon_mapping` (
	`iconmappingid`          bigint unsigned                           NOT NULL,
	`iconmapid`              bigint unsigned                           NOT NULL,
	`iconid`                 bigint unsigned                           NOT NULL,
	`inventory_link`         integer         DEFAULT '0'               NOT NULL,
	`expression`             varchar(64)     DEFAULT ''                NOT NULL,
	`sortorder`              integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (iconmappingid)
) ENGINE=InnoDB;
CREATE INDEX `icon_mapping_1` ON `icon_mapping` (`iconmapid`);
CREATE INDEX `icon_mapping_2` ON `icon_mapping` (`iconid`);
CREATE TABLE `sysmaps` (
	`sysmapid`               bigint unsigned                           NOT NULL,
	`name`                   varchar(128)    DEFAULT ''                NOT NULL,
	`width`                  integer         DEFAULT '600'             NOT NULL,
	`height`                 integer         DEFAULT '400'             NOT NULL,
	`backgroundid`           bigint unsigned                           NULL,
	`label_type`             integer         DEFAULT '2'               NOT NULL,
	`label_location`         integer         DEFAULT '0'               NOT NULL,
	`highlight`              integer         DEFAULT '1'               NOT NULL,
	`expandproblem`          integer         DEFAULT '1'               NOT NULL,
	`markelements`           integer         DEFAULT '0'               NOT NULL,
	`show_unack`             integer         DEFAULT '0'               NOT NULL,
	`grid_size`              integer         DEFAULT '50'              NOT NULL,
	`grid_show`              integer         DEFAULT '1'               NOT NULL,
	`grid_align`             integer         DEFAULT '1'               NOT NULL,
	`label_format`           integer         DEFAULT '0'               NOT NULL,
	`label_type_host`        integer         DEFAULT '2'               NOT NULL,
	`label_type_hostgroup`   integer         DEFAULT '2'               NOT NULL,
	`label_type_trigger`     integer         DEFAULT '2'               NOT NULL,
	`label_type_map`         integer         DEFAULT '2'               NOT NULL,
	`label_type_image`       integer         DEFAULT '2'               NOT NULL,
	`label_string_host`      varchar(255)    DEFAULT ''                NOT NULL,
	`label_string_hostgroup` varchar(255)    DEFAULT ''                NOT NULL,
	`label_string_trigger`   varchar(255)    DEFAULT ''                NOT NULL,
	`label_string_map`       varchar(255)    DEFAULT ''                NOT NULL,
	`label_string_image`     varchar(255)    DEFAULT ''                NOT NULL,
	`iconmapid`              bigint unsigned                           NULL,
	`expand_macros`          integer         DEFAULT '0'               NOT NULL,
	`severity_min`           integer         DEFAULT '0'               NOT NULL,
	`userid`                 bigint unsigned                           NOT NULL,
	`private`                integer         DEFAULT '1'               NOT NULL,
	`show_suppressed`        integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (sysmapid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `sysmaps_1` ON `sysmaps` (`name`);
CREATE INDEX `sysmaps_2` ON `sysmaps` (`backgroundid`);
CREATE INDEX `sysmaps_3` ON `sysmaps` (`iconmapid`);
CREATE TABLE `sysmaps_elements` (
	`selementid`             bigint unsigned                           NOT NULL,
	`sysmapid`               bigint unsigned                           NOT NULL,
	`elementid`              bigint unsigned DEFAULT '0'               NOT NULL,
	`elementtype`            integer         DEFAULT '0'               NOT NULL,
	`iconid_off`             bigint unsigned                           NULL,
	`iconid_on`              bigint unsigned                           NULL,
	`label`                  varchar(2048)   DEFAULT ''                NOT NULL,
	`label_location`         integer         DEFAULT '-1'              NOT NULL,
	`x`                      integer         DEFAULT '0'               NOT NULL,
	`y`                      integer         DEFAULT '0'               NOT NULL,
	`iconid_disabled`        bigint unsigned                           NULL,
	`iconid_maintenance`     bigint unsigned                           NULL,
	`elementsubtype`         integer         DEFAULT '0'               NOT NULL,
	`areatype`               integer         DEFAULT '0'               NOT NULL,
	`width`                  integer         DEFAULT '200'             NOT NULL,
	`height`                 integer         DEFAULT '200'             NOT NULL,
	`viewtype`               integer         DEFAULT '0'               NOT NULL,
	`use_iconmap`            integer         DEFAULT '1'               NOT NULL,
	`application`            varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (selementid)
) ENGINE=InnoDB;
CREATE INDEX `sysmaps_elements_1` ON `sysmaps_elements` (`sysmapid`);
CREATE INDEX `sysmaps_elements_2` ON `sysmaps_elements` (`iconid_off`);
CREATE INDEX `sysmaps_elements_3` ON `sysmaps_elements` (`iconid_on`);
CREATE INDEX `sysmaps_elements_4` ON `sysmaps_elements` (`iconid_disabled`);
CREATE INDEX `sysmaps_elements_5` ON `sysmaps_elements` (`iconid_maintenance`);
CREATE TABLE `sysmaps_links` (
	`linkid`                 bigint unsigned                           NOT NULL,
	`sysmapid`               bigint unsigned                           NOT NULL,
	`selementid1`            bigint unsigned                           NOT NULL,
	`selementid2`            bigint unsigned                           NOT NULL,
	`drawtype`               integer         DEFAULT '0'               NOT NULL,
	`color`                  varchar(6)      DEFAULT '000000'          NOT NULL,
	`label`                  varchar(2048)   DEFAULT ''                NOT NULL,
	PRIMARY KEY (linkid)
) ENGINE=InnoDB;
CREATE INDEX `sysmaps_links_1` ON `sysmaps_links` (`sysmapid`);
CREATE INDEX `sysmaps_links_2` ON `sysmaps_links` (`selementid1`);
CREATE INDEX `sysmaps_links_3` ON `sysmaps_links` (`selementid2`);
CREATE TABLE `sysmaps_link_triggers` (
	`linktriggerid`          bigint unsigned                           NOT NULL,
	`linkid`                 bigint unsigned                           NOT NULL,
	`triggerid`              bigint unsigned                           NOT NULL,
	`drawtype`               integer         DEFAULT '0'               NOT NULL,
	`color`                  varchar(6)      DEFAULT '000000'          NOT NULL,
	PRIMARY KEY (linktriggerid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `sysmaps_link_triggers_1` ON `sysmaps_link_triggers` (`linkid`,`triggerid`);
CREATE INDEX `sysmaps_link_triggers_2` ON `sysmaps_link_triggers` (`triggerid`);
CREATE TABLE `sysmap_element_url` (
	`sysmapelementurlid`     bigint unsigned                           NOT NULL,
	`selementid`             bigint unsigned                           NOT NULL,
	`name`                   varchar(255)                              NOT NULL,
	`url`                    varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (sysmapelementurlid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `sysmap_element_url_1` ON `sysmap_element_url` (`selementid`,`name`);
CREATE TABLE `sysmap_url` (
	`sysmapurlid`            bigint unsigned                           NOT NULL,
	`sysmapid`               bigint unsigned                           NOT NULL,
	`name`                   varchar(255)                              NOT NULL,
	`url`                    varchar(255)    DEFAULT ''                NOT NULL,
	`elementtype`            integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (sysmapurlid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `sysmap_url_1` ON `sysmap_url` (`sysmapid`,`name`);
CREATE TABLE `sysmap_user` (
	`sysmapuserid`           bigint unsigned                           NOT NULL,
	`sysmapid`               bigint unsigned                           NOT NULL,
	`userid`                 bigint unsigned                           NOT NULL,
	`permission`             integer         DEFAULT '2'               NOT NULL,
	PRIMARY KEY (sysmapuserid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `sysmap_user_1` ON `sysmap_user` (`sysmapid`,`userid`);
CREATE TABLE `sysmap_usrgrp` (
	`sysmapusrgrpid`         bigint unsigned                           NOT NULL,
	`sysmapid`               bigint unsigned                           NOT NULL,
	`usrgrpid`               bigint unsigned                           NOT NULL,
	`permission`             integer         DEFAULT '2'               NOT NULL,
	PRIMARY KEY (sysmapusrgrpid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `sysmap_usrgrp_1` ON `sysmap_usrgrp` (`sysmapid`,`usrgrpid`);
CREATE TABLE `maintenances_hosts` (
	`maintenance_hostid`     bigint unsigned                           NOT NULL,
	`maintenanceid`          bigint unsigned                           NOT NULL,
	`hostid`                 bigint unsigned                           NOT NULL,
	PRIMARY KEY (maintenance_hostid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `maintenances_hosts_1` ON `maintenances_hosts` (`maintenanceid`,`hostid`);
CREATE INDEX `maintenances_hosts_2` ON `maintenances_hosts` (`hostid`);
CREATE TABLE `maintenances_groups` (
	`maintenance_groupid`    bigint unsigned                           NOT NULL,
	`maintenanceid`          bigint unsigned                           NOT NULL,
	`groupid`                bigint unsigned                           NOT NULL,
	PRIMARY KEY (maintenance_groupid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `maintenances_groups_1` ON `maintenances_groups` (`maintenanceid`,`groupid`);
CREATE INDEX `maintenances_groups_2` ON `maintenances_groups` (`groupid`);
CREATE TABLE `timeperiods` (
	`timeperiodid`           bigint unsigned                           NOT NULL,
	`timeperiod_type`        integer         DEFAULT '0'               NOT NULL,
	`every`                  integer         DEFAULT '1'               NOT NULL,
	`month`                  integer         DEFAULT '0'               NOT NULL,
	`dayofweek`              integer         DEFAULT '0'               NOT NULL,
	`day`                    integer         DEFAULT '0'               NOT NULL,
	`start_time`             integer         DEFAULT '0'               NOT NULL,
	`period`                 integer         DEFAULT '0'               NOT NULL,
	`start_date`             integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (timeperiodid)
) ENGINE=InnoDB;
CREATE TABLE `maintenances_windows` (
	`maintenance_timeperiodid` bigint unsigned                           NOT NULL,
	`maintenanceid`          bigint unsigned                           NOT NULL,
	`timeperiodid`           bigint unsigned                           NOT NULL,
	PRIMARY KEY (maintenance_timeperiodid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `maintenances_windows_1` ON `maintenances_windows` (`maintenanceid`,`timeperiodid`);
CREATE INDEX `maintenances_windows_2` ON `maintenances_windows` (`timeperiodid`);
CREATE TABLE `regexps` (
	`regexpid`               bigint unsigned                           NOT NULL,
	`name`                   varchar(128)    DEFAULT ''                NOT NULL,
	`test_string`            text                                      NOT NULL,
	PRIMARY KEY (regexpid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `regexps_1` ON `regexps` (`name`);
CREATE TABLE `expressions` (
	`expressionid`           bigint unsigned                           NOT NULL,
	`regexpid`               bigint unsigned                           NOT NULL,
	`expression`             varchar(255)    DEFAULT ''                NOT NULL,
	`expression_type`        integer         DEFAULT '0'               NOT NULL,
	`exp_delimiter`          varchar(1)      DEFAULT ''                NOT NULL,
	`case_sensitive`         integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (expressionid)
) ENGINE=InnoDB;
CREATE INDEX `expressions_1` ON `expressions` (`regexpid`);
CREATE TABLE `ids` (
	`table_name`             varchar(64)     DEFAULT ''                NOT NULL,
	`field_name`             varchar(64)     DEFAULT ''                NOT NULL,
	`nextid`                 bigint unsigned                           NOT NULL,
	PRIMARY KEY (table_name,field_name)
) ENGINE=InnoDB;
CREATE TABLE `alerts` (
	`alertid`                bigint unsigned                           NOT NULL,
	`actionid`               bigint unsigned                           NOT NULL,
	`eventid`                bigint unsigned                           NOT NULL,
	`userid`                 bigint unsigned                           NULL,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`mediatypeid`            bigint unsigned                           NULL,
	`sendto`                 varchar(1024)   DEFAULT ''                NOT NULL,
	`subject`                varchar(255)    DEFAULT ''                NOT NULL,
	`message`                text                                      NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	`retries`                integer         DEFAULT '0'               NOT NULL,
	`error`                  varchar(2048)   DEFAULT ''                NOT NULL,
	`esc_step`               integer         DEFAULT '0'               NOT NULL,
	`alerttype`              integer         DEFAULT '0'               NOT NULL,
	`p_eventid`              bigint unsigned                           NULL,
	`acknowledgeid`          bigint unsigned                           NULL,
	PRIMARY KEY (alertid)
) ENGINE=InnoDB;
CREATE INDEX `alerts_1` ON `alerts` (`actionid`);
CREATE INDEX `alerts_2` ON `alerts` (`clock`);
CREATE INDEX `alerts_3` ON `alerts` (`eventid`);
CREATE INDEX `alerts_4` ON `alerts` (`status`);
CREATE INDEX `alerts_5` ON `alerts` (`mediatypeid`);
CREATE INDEX `alerts_6` ON `alerts` (`userid`);
CREATE INDEX `alerts_7` ON `alerts` (`p_eventid`);
CREATE TABLE `history` (
	`itemid`                 bigint unsigned                           NOT NULL,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`value`                  double(16,4)    DEFAULT '0.0000'          NOT NULL,
	`ns`                     integer         DEFAULT '0'               NOT NULL
) ENGINE=InnoDB;
CREATE INDEX `history_1` ON `history` (`itemid`,`clock`);
CREATE TABLE `history_uint` (
	`itemid`                 bigint unsigned                           NOT NULL,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`value`                  bigint unsigned DEFAULT '0'               NOT NULL,
	`ns`                     integer         DEFAULT '0'               NOT NULL
) ENGINE=InnoDB;
CREATE INDEX `history_uint_1` ON `history_uint` (`itemid`,`clock`);
CREATE TABLE `history_str` (
	`itemid`                 bigint unsigned                           NOT NULL,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`value`                  varchar(255)    DEFAULT ''                NOT NULL,
	`ns`                     integer         DEFAULT '0'               NOT NULL
) ENGINE=InnoDB;
CREATE INDEX `history_str_1` ON `history_str` (`itemid`,`clock`);
CREATE TABLE `history_log` (
	`itemid`                 bigint unsigned                           NOT NULL,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`timestamp`              integer         DEFAULT '0'               NOT NULL,
	`source`                 varchar(64)     DEFAULT ''                NOT NULL,
	`severity`               integer         DEFAULT '0'               NOT NULL,
	`value`                  text                                      NOT NULL,
	`logeventid`             integer         DEFAULT '0'               NOT NULL,
	`ns`                     integer         DEFAULT '0'               NOT NULL
) ENGINE=InnoDB;
CREATE INDEX `history_log_1` ON `history_log` (`itemid`,`clock`);
CREATE TABLE `history_text` (
	`itemid`                 bigint unsigned                           NOT NULL,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`value`                  text                                      NOT NULL,
	`ns`                     integer         DEFAULT '0'               NOT NULL
) ENGINE=InnoDB;
CREATE INDEX `history_text_1` ON `history_text` (`itemid`,`clock`);
CREATE TABLE `proxy_history` (
	`id`                     bigint unsigned                           NOT NULL auto_increment,
	`itemid`                 bigint unsigned                           NOT NULL,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`timestamp`              integer         DEFAULT '0'               NOT NULL,
	`source`                 varchar(64)     DEFAULT ''                NOT NULL,
	`severity`               integer         DEFAULT '0'               NOT NULL,
	`value`                  longtext                                  NOT NULL,
	`logeventid`             integer         DEFAULT '0'               NOT NULL,
	`ns`                     integer         DEFAULT '0'               NOT NULL,
	`state`                  integer         DEFAULT '0'               NOT NULL,
	`lastlogsize`            bigint unsigned DEFAULT '0'               NOT NULL,
	`mtime`                  integer         DEFAULT '0'               NOT NULL,
	`flags`                  integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE INDEX `proxy_history_1` ON `proxy_history` (`clock`);
CREATE TABLE `proxy_dhistory` (
	`id`                     bigint unsigned                           NOT NULL auto_increment,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`druleid`                bigint unsigned                           NOT NULL,
	`ip`                     varchar(39)     DEFAULT ''                NOT NULL,
	`port`                   integer         DEFAULT '0'               NOT NULL,
	`value`                  varchar(255)    DEFAULT ''                NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	`dcheckid`               bigint unsigned                           NULL,
	`dns`                    varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE INDEX `proxy_dhistory_1` ON `proxy_dhistory` (`clock`);
CREATE INDEX `proxy_dhistory_2` ON `proxy_dhistory` (`druleid`);
CREATE TABLE `events` (
	`eventid`                bigint unsigned                           NOT NULL,
	`source`                 integer         DEFAULT '0'               NOT NULL,
	`object`                 integer         DEFAULT '0'               NOT NULL,
	`objectid`               bigint unsigned DEFAULT '0'               NOT NULL,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`value`                  integer         DEFAULT '0'               NOT NULL,
	`acknowledged`           integer         DEFAULT '0'               NOT NULL,
	`ns`                     integer         DEFAULT '0'               NOT NULL,
	`name`                   varchar(2048)   DEFAULT ''                NOT NULL,
	`severity`               integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (eventid)
) ENGINE=InnoDB;
CREATE INDEX `events_1` ON `events` (`source`,`object`,`objectid`,`clock`);
CREATE INDEX `events_2` ON `events` (`source`,`object`,`clock`);
CREATE TABLE `trends` (
	`itemid`                 bigint unsigned                           NOT NULL,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`num`                    integer         DEFAULT '0'               NOT NULL,
	`value_min`              double(16,4)    DEFAULT '0.0000'          NOT NULL,
	`value_avg`              double(16,4)    DEFAULT '0.0000'          NOT NULL,
	`value_max`              double(16,4)    DEFAULT '0.0000'          NOT NULL,
	PRIMARY KEY (itemid,clock)
) ENGINE=InnoDB;
CREATE TABLE `trends_uint` (
	`itemid`                 bigint unsigned                           NOT NULL,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`num`                    integer         DEFAULT '0'               NOT NULL,
	`value_min`              bigint unsigned DEFAULT '0'               NOT NULL,
	`value_avg`              bigint unsigned DEFAULT '0'               NOT NULL,
	`value_max`              bigint unsigned DEFAULT '0'               NOT NULL,
	PRIMARY KEY (itemid,clock)
) ENGINE=InnoDB;
CREATE TABLE `acknowledges` (
	`acknowledgeid`          bigint unsigned                           NOT NULL,
	`userid`                 bigint unsigned                           NOT NULL,
	`eventid`                bigint unsigned                           NOT NULL,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`message`                varchar(255)    DEFAULT ''                NOT NULL,
	`action`                 integer         DEFAULT '0'               NOT NULL,
	`old_severity`           integer         DEFAULT '0'               NOT NULL,
	`new_severity`           integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (acknowledgeid)
) ENGINE=InnoDB;
CREATE INDEX `acknowledges_1` ON `acknowledges` (`userid`);
CREATE INDEX `acknowledges_2` ON `acknowledges` (`eventid`);
CREATE INDEX `acknowledges_3` ON `acknowledges` (`clock`);
CREATE TABLE `auditlog` (
	`auditid`                bigint unsigned                           NOT NULL,
	`userid`                 bigint unsigned                           NOT NULL,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`action`                 integer         DEFAULT '0'               NOT NULL,
	`resourcetype`           integer         DEFAULT '0'               NOT NULL,
	`details`                varchar(128)    DEFAULT '0'               NOT NULL,
	`ip`                     varchar(39)     DEFAULT ''                NOT NULL,
	`resourceid`             bigint unsigned DEFAULT '0'               NOT NULL,
	`resourcename`           varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (auditid)
) ENGINE=InnoDB;
CREATE INDEX `auditlog_1` ON `auditlog` (`userid`,`clock`);
CREATE INDEX `auditlog_2` ON `auditlog` (`clock`);
CREATE TABLE `auditlog_details` (
	`auditdetailid`          bigint unsigned                           NOT NULL,
	`auditid`                bigint unsigned                           NOT NULL,
	`table_name`             varchar(64)     DEFAULT ''                NOT NULL,
	`field_name`             varchar(64)     DEFAULT ''                NOT NULL,
	`oldvalue`               text                                      NOT NULL,
	`newvalue`               text                                      NOT NULL,
	PRIMARY KEY (auditdetailid)
) ENGINE=InnoDB;
CREATE INDEX `auditlog_details_1` ON `auditlog_details` (`auditid`);
CREATE TABLE `service_alarms` (
	`servicealarmid`         bigint unsigned                           NOT NULL,
	`serviceid`              bigint unsigned                           NOT NULL,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`value`                  integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (servicealarmid)
) ENGINE=InnoDB;
CREATE INDEX `service_alarms_1` ON `service_alarms` (`serviceid`,`clock`);
CREATE INDEX `service_alarms_2` ON `service_alarms` (`clock`);
CREATE TABLE `autoreg_host` (
	`autoreg_hostid`         bigint unsigned                           NOT NULL,
	`proxy_hostid`           bigint unsigned                           NULL,
	`host`                   varchar(64)     DEFAULT ''                NOT NULL,
	`listen_ip`              varchar(39)     DEFAULT ''                NOT NULL,
	`listen_port`            integer         DEFAULT '0'               NOT NULL,
	`listen_dns`             varchar(255)    DEFAULT ''                NOT NULL,
	`host_metadata`          varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (autoreg_hostid)
) ENGINE=InnoDB;
CREATE INDEX `autoreg_host_1` ON `autoreg_host` (`host`);
CREATE INDEX `autoreg_host_2` ON `autoreg_host` (`proxy_hostid`);
CREATE TABLE `proxy_autoreg_host` (
	`id`                     bigint unsigned                           NOT NULL auto_increment,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`host`                   varchar(64)     DEFAULT ''                NOT NULL,
	`listen_ip`              varchar(39)     DEFAULT ''                NOT NULL,
	`listen_port`            integer         DEFAULT '0'               NOT NULL,
	`listen_dns`             varchar(255)    DEFAULT ''                NOT NULL,
	`host_metadata`          varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE INDEX `proxy_autoreg_host_1` ON `proxy_autoreg_host` (`clock`);
CREATE TABLE `dhosts` (
	`dhostid`                bigint unsigned                           NOT NULL,
	`druleid`                bigint unsigned                           NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	`lastup`                 integer         DEFAULT '0'               NOT NULL,
	`lastdown`               integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (dhostid)
) ENGINE=InnoDB;
CREATE INDEX `dhosts_1` ON `dhosts` (`druleid`);
CREATE TABLE `dservices` (
	`dserviceid`             bigint unsigned                           NOT NULL,
	`dhostid`                bigint unsigned                           NOT NULL,
	`value`                  varchar(255)    DEFAULT ''                NOT NULL,
	`port`                   integer         DEFAULT '0'               NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	`lastup`                 integer         DEFAULT '0'               NOT NULL,
	`lastdown`               integer         DEFAULT '0'               NOT NULL,
	`dcheckid`               bigint unsigned                           NOT NULL,
	`ip`                     varchar(39)     DEFAULT ''                NOT NULL,
	`dns`                    varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (dserviceid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `dservices_1` ON `dservices` (`dcheckid`,`ip`,`port`);
CREATE INDEX `dservices_2` ON `dservices` (`dhostid`);
CREATE TABLE `escalations` (
	`escalationid`           bigint unsigned                           NOT NULL,
	`actionid`               bigint unsigned                           NOT NULL,
	`triggerid`              bigint unsigned                           NULL,
	`eventid`                bigint unsigned                           NULL,
	`r_eventid`              bigint unsigned                           NULL,
	`nextcheck`              integer         DEFAULT '0'               NOT NULL,
	`esc_step`               integer         DEFAULT '0'               NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	`itemid`                 bigint unsigned                           NULL,
	`acknowledgeid`          bigint unsigned                           NULL,
	PRIMARY KEY (escalationid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `escalations_1` ON `escalations` (`triggerid`,`itemid`,`escalationid`);
CREATE INDEX `escalations_2` ON `escalations` (`eventid`);
CREATE INDEX `escalations_3` ON `escalations` (`nextcheck`);
CREATE TABLE `globalvars` (
	`globalvarid`            bigint unsigned                           NOT NULL,
	`snmp_lastsize`          bigint unsigned DEFAULT '0'               NOT NULL,
	PRIMARY KEY (globalvarid)
) ENGINE=InnoDB;
CREATE TABLE `graph_discovery` (
	`graphid`                bigint unsigned                           NOT NULL,
	`parent_graphid`         bigint unsigned                           NOT NULL,
	PRIMARY KEY (graphid)
) ENGINE=InnoDB;
CREATE INDEX `graph_discovery_1` ON `graph_discovery` (`parent_graphid`);
CREATE TABLE `host_inventory` (
	`hostid`                 bigint unsigned                           NOT NULL,
	`inventory_mode`         integer         DEFAULT '0'               NOT NULL,
	`type`                   varchar(64)     DEFAULT ''                NOT NULL,
	`type_full`              varchar(64)     DEFAULT ''                NOT NULL,
	`name`                   varchar(64)     DEFAULT ''                NOT NULL,
	`alias`                  varchar(64)     DEFAULT ''                NOT NULL,
	`os`                     varchar(64)     DEFAULT ''                NOT NULL,
	`os_full`                varchar(255)    DEFAULT ''                NOT NULL,
	`os_short`               varchar(64)     DEFAULT ''                NOT NULL,
	`serialno_a`             varchar(64)     DEFAULT ''                NOT NULL,
	`serialno_b`             varchar(64)     DEFAULT ''                NOT NULL,
	`tag`                    varchar(64)     DEFAULT ''                NOT NULL,
	`asset_tag`              varchar(64)     DEFAULT ''                NOT NULL,
	`macaddress_a`           varchar(64)     DEFAULT ''                NOT NULL,
	`macaddress_b`           varchar(64)     DEFAULT ''                NOT NULL,
	`hardware`               varchar(255)    DEFAULT ''                NOT NULL,
	`hardware_full`          text                                      NOT NULL,
	`software`               varchar(255)    DEFAULT ''                NOT NULL,
	`software_full`          text                                      NOT NULL,
	`software_app_a`         varchar(64)     DEFAULT ''                NOT NULL,
	`software_app_b`         varchar(64)     DEFAULT ''                NOT NULL,
	`software_app_c`         varchar(64)     DEFAULT ''                NOT NULL,
	`software_app_d`         varchar(64)     DEFAULT ''                NOT NULL,
	`software_app_e`         varchar(64)     DEFAULT ''                NOT NULL,
	`contact`                text                                      NOT NULL,
	`location`               text                                      NOT NULL,
	`location_lat`           varchar(16)     DEFAULT ''                NOT NULL,
	`location_lon`           varchar(16)     DEFAULT ''                NOT NULL,
	`notes`                  text                                      NOT NULL,
	`chassis`                varchar(64)     DEFAULT ''                NOT NULL,
	`model`                  varchar(64)     DEFAULT ''                NOT NULL,
	`hw_arch`                varchar(32)     DEFAULT ''                NOT NULL,
	`vendor`                 varchar(64)     DEFAULT ''                NOT NULL,
	`contract_number`        varchar(64)     DEFAULT ''                NOT NULL,
	`installer_name`         varchar(64)     DEFAULT ''                NOT NULL,
	`deployment_status`      varchar(64)     DEFAULT ''                NOT NULL,
	`url_a`                  varchar(255)    DEFAULT ''                NOT NULL,
	`url_b`                  varchar(255)    DEFAULT ''                NOT NULL,
	`url_c`                  varchar(255)    DEFAULT ''                NOT NULL,
	`host_networks`          text                                      NOT NULL,
	`host_netmask`           varchar(39)     DEFAULT ''                NOT NULL,
	`host_router`            varchar(39)     DEFAULT ''                NOT NULL,
	`oob_ip`                 varchar(39)     DEFAULT ''                NOT NULL,
	`oob_netmask`            varchar(39)     DEFAULT ''                NOT NULL,
	`oob_router`             varchar(39)     DEFAULT ''                NOT NULL,
	`date_hw_purchase`       varchar(64)     DEFAULT ''                NOT NULL,
	`date_hw_install`        varchar(64)     DEFAULT ''                NOT NULL,
	`date_hw_expiry`         varchar(64)     DEFAULT ''                NOT NULL,
	`date_hw_decomm`         varchar(64)     DEFAULT ''                NOT NULL,
	`site_address_a`         varchar(128)    DEFAULT ''                NOT NULL,
	`site_address_b`         varchar(128)    DEFAULT ''                NOT NULL,
	`site_address_c`         varchar(128)    DEFAULT ''                NOT NULL,
	`site_city`              varchar(128)    DEFAULT ''                NOT NULL,
	`site_state`             varchar(64)     DEFAULT ''                NOT NULL,
	`site_country`           varchar(64)     DEFAULT ''                NOT NULL,
	`site_zip`               varchar(64)     DEFAULT ''                NOT NULL,
	`site_rack`              varchar(128)    DEFAULT ''                NOT NULL,
	`site_notes`             text                                      NOT NULL,
	`poc_1_name`             varchar(128)    DEFAULT ''                NOT NULL,
	`poc_1_email`            varchar(128)    DEFAULT ''                NOT NULL,
	`poc_1_phone_a`          varchar(64)     DEFAULT ''                NOT NULL,
	`poc_1_phone_b`          varchar(64)     DEFAULT ''                NOT NULL,
	`poc_1_cell`             varchar(64)     DEFAULT ''                NOT NULL,
	`poc_1_screen`           varchar(64)     DEFAULT ''                NOT NULL,
	`poc_1_notes`            text                                      NOT NULL,
	`poc_2_name`             varchar(128)    DEFAULT ''                NOT NULL,
	`poc_2_email`            varchar(128)    DEFAULT ''                NOT NULL,
	`poc_2_phone_a`          varchar(64)     DEFAULT ''                NOT NULL,
	`poc_2_phone_b`          varchar(64)     DEFAULT ''                NOT NULL,
	`poc_2_cell`             varchar(64)     DEFAULT ''                NOT NULL,
	`poc_2_screen`           varchar(64)     DEFAULT ''                NOT NULL,
	`poc_2_notes`            text                                      NOT NULL,
	PRIMARY KEY (hostid)
) ENGINE=InnoDB;
CREATE TABLE `housekeeper` (
	`housekeeperid`          bigint unsigned                           NOT NULL,
	`tablename`              varchar(64)     DEFAULT ''                NOT NULL,
	`field`                  varchar(64)     DEFAULT ''                NOT NULL,
	`value`                  bigint unsigned                           NOT NULL,
	PRIMARY KEY (housekeeperid)
) ENGINE=InnoDB;
CREATE TABLE `images` (
	`imageid`                bigint unsigned                           NOT NULL,
	`imagetype`              integer         DEFAULT '0'               NOT NULL,
	`name`                   varchar(64)     DEFAULT '0'               NOT NULL,
	`image`                  longblob                                  NOT NULL,
	PRIMARY KEY (imageid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `images_1` ON `images` (`name`);
CREATE TABLE `item_discovery` (
	`itemdiscoveryid`        bigint unsigned                           NOT NULL,
	`itemid`                 bigint unsigned                           NOT NULL,
	`parent_itemid`          bigint unsigned                           NOT NULL,
	`key_`                   varchar(255)    DEFAULT ''                NOT NULL,
	`lastcheck`              integer         DEFAULT '0'               NOT NULL,
	`ts_delete`              integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (itemdiscoveryid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `item_discovery_1` ON `item_discovery` (`itemid`,`parent_itemid`);
CREATE INDEX `item_discovery_2` ON `item_discovery` (`parent_itemid`);
CREATE TABLE `host_discovery` (
	`hostid`                 bigint unsigned                           NOT NULL,
	`parent_hostid`          bigint unsigned                           NULL,
	`parent_itemid`          bigint unsigned                           NULL,
	`host`                   varchar(64)     DEFAULT ''                NOT NULL,
	`lastcheck`              integer         DEFAULT '0'               NOT NULL,
	`ts_delete`              integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (hostid)
) ENGINE=InnoDB;
CREATE TABLE `interface_discovery` (
	`interfaceid`            bigint unsigned                           NOT NULL,
	`parent_interfaceid`     bigint unsigned                           NOT NULL,
	PRIMARY KEY (interfaceid)
) ENGINE=InnoDB;
CREATE TABLE `profiles` (
	`profileid`              bigint unsigned                           NOT NULL,
	`userid`                 bigint unsigned                           NOT NULL,
	`idx`                    varchar(96)     DEFAULT ''                NOT NULL,
	`idx2`                   bigint unsigned DEFAULT '0'               NOT NULL,
	`value_id`               bigint unsigned DEFAULT '0'               NOT NULL,
	`value_int`              integer         DEFAULT '0'               NOT NULL,
	`value_str`              varchar(255)    DEFAULT ''                NOT NULL,
	`source`                 varchar(96)     DEFAULT ''                NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (profileid)
) ENGINE=InnoDB;
CREATE INDEX `profiles_1` ON `profiles` (`userid`,`idx`,`idx2`);
CREATE INDEX `profiles_2` ON `profiles` (`userid`,`profileid`);
CREATE TABLE `sessions` (
	`sessionid`              varchar(32)     DEFAULT ''                NOT NULL,
	`userid`                 bigint unsigned                           NOT NULL,
	`lastaccess`             integer         DEFAULT '0'               NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (sessionid)
) ENGINE=InnoDB;
CREATE INDEX `sessions_1` ON `sessions` (`userid`,`status`,`lastaccess`);
CREATE TABLE `trigger_discovery` (
	`triggerid`              bigint unsigned                           NOT NULL,
	`parent_triggerid`       bigint unsigned                           NOT NULL,
	PRIMARY KEY (triggerid)
) ENGINE=InnoDB;
CREATE INDEX `trigger_discovery_1` ON `trigger_discovery` (`parent_triggerid`);
CREATE TABLE `application_template` (
	`application_templateid` bigint unsigned                           NOT NULL,
	`applicationid`          bigint unsigned                           NOT NULL,
	`templateid`             bigint unsigned                           NOT NULL,
	PRIMARY KEY (application_templateid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `application_template_1` ON `application_template` (`applicationid`,`templateid`);
CREATE INDEX `application_template_2` ON `application_template` (`templateid`);
CREATE TABLE `item_condition` (
	`item_conditionid`       bigint unsigned                           NOT NULL,
	`itemid`                 bigint unsigned                           NOT NULL,
	`operator`               integer         DEFAULT '8'               NOT NULL,
	`macro`                  varchar(64)     DEFAULT ''                NOT NULL,
	`value`                  varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (item_conditionid)
) ENGINE=InnoDB;
CREATE INDEX `item_condition_1` ON `item_condition` (`itemid`);
CREATE TABLE `application_prototype` (
	`application_prototypeid` bigint unsigned                           NOT NULL,
	`itemid`                 bigint unsigned                           NOT NULL,
	`templateid`             bigint unsigned                           NULL,
	`name`                   varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (application_prototypeid)
) ENGINE=InnoDB;
CREATE INDEX `application_prototype_1` ON `application_prototype` (`itemid`);
CREATE INDEX `application_prototype_2` ON `application_prototype` (`templateid`);
CREATE TABLE `item_application_prototype` (
	`item_application_prototypeid` bigint unsigned                           NOT NULL,
	`application_prototypeid` bigint unsigned                           NOT NULL,
	`itemid`                 bigint unsigned                           NOT NULL,
	PRIMARY KEY (item_application_prototypeid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `item_application_prototype_1` ON `item_application_prototype` (`application_prototypeid`,`itemid`);
CREATE INDEX `item_application_prototype_2` ON `item_application_prototype` (`itemid`);
CREATE TABLE `application_discovery` (
	`application_discoveryid` bigint unsigned                           NOT NULL,
	`applicationid`          bigint unsigned                           NOT NULL,
	`application_prototypeid` bigint unsigned                           NOT NULL,
	`name`                   varchar(255)    DEFAULT ''                NOT NULL,
	`lastcheck`              integer         DEFAULT '0'               NOT NULL,
	`ts_delete`              integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (application_discoveryid)
) ENGINE=InnoDB;
CREATE INDEX `application_discovery_1` ON `application_discovery` (`applicationid`);
CREATE INDEX `application_discovery_2` ON `application_discovery` (`application_prototypeid`);
CREATE TABLE `opinventory` (
	`operationid`            bigint unsigned                           NOT NULL,
	`inventory_mode`         integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (operationid)
) ENGINE=InnoDB;
CREATE TABLE `trigger_tag` (
	`triggertagid`           bigint unsigned                           NOT NULL,
	`triggerid`              bigint unsigned                           NOT NULL,
	`tag`                    varchar(255)    DEFAULT ''                NOT NULL,
	`value`                  varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (triggertagid)
) ENGINE=InnoDB;
CREATE INDEX `trigger_tag_1` ON `trigger_tag` (`triggerid`);
CREATE TABLE `event_tag` (
	`eventtagid`             bigint unsigned                           NOT NULL,
	`eventid`                bigint unsigned                           NOT NULL,
	`tag`                    varchar(255)    DEFAULT ''                NOT NULL,
	`value`                  varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (eventtagid)
) ENGINE=InnoDB;
CREATE INDEX `event_tag_1` ON `event_tag` (`eventid`);
CREATE TABLE `problem` (
	`eventid`                bigint unsigned                           NOT NULL,
	`source`                 integer         DEFAULT '0'               NOT NULL,
	`object`                 integer         DEFAULT '0'               NOT NULL,
	`objectid`               bigint unsigned DEFAULT '0'               NOT NULL,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`ns`                     integer         DEFAULT '0'               NOT NULL,
	`r_eventid`              bigint unsigned                           NULL,
	`r_clock`                integer         DEFAULT '0'               NOT NULL,
	`r_ns`                   integer         DEFAULT '0'               NOT NULL,
	`correlationid`          bigint unsigned                           NULL,
	`userid`                 bigint unsigned                           NULL,
	`name`                   varchar(2048)   DEFAULT ''                NOT NULL,
	`acknowledged`           integer         DEFAULT '0'               NOT NULL,
	`severity`               integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (eventid)
) ENGINE=InnoDB;
CREATE INDEX `problem_1` ON `problem` (`source`,`object`,`objectid`);
CREATE INDEX `problem_2` ON `problem` (`r_clock`);
CREATE INDEX `problem_3` ON `problem` (`r_eventid`);
CREATE TABLE `problem_tag` (
	`problemtagid`           bigint unsigned                           NOT NULL,
	`eventid`                bigint unsigned                           NOT NULL,
	`tag`                    varchar(255)    DEFAULT ''                NOT NULL,
	`value`                  varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (problemtagid)
) ENGINE=InnoDB;
CREATE INDEX `problem_tag_1` ON `problem_tag` (`eventid`,`tag`,`value`);
CREATE TABLE `tag_filter` (
	`tag_filterid`           bigint unsigned                           NOT NULL,
	`usrgrpid`               bigint unsigned                           NOT NULL,
	`groupid`                bigint unsigned                           NOT NULL,
	`tag`                    varchar(255)    DEFAULT ''                NOT NULL,
	`value`                  varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (tag_filterid)
) ENGINE=InnoDB;
CREATE TABLE `event_recovery` (
	`eventid`                bigint unsigned                           NOT NULL,
	`r_eventid`              bigint unsigned                           NOT NULL,
	`c_eventid`              bigint unsigned                           NULL,
	`correlationid`          bigint unsigned                           NULL,
	`userid`                 bigint unsigned                           NULL,
	PRIMARY KEY (eventid)
) ENGINE=InnoDB;
CREATE INDEX `event_recovery_1` ON `event_recovery` (`r_eventid`);
CREATE INDEX `event_recovery_2` ON `event_recovery` (`c_eventid`);
CREATE TABLE `correlation` (
	`correlationid`          bigint unsigned                           NOT NULL,
	`name`                   varchar(255)    DEFAULT ''                NOT NULL,
	`description`            text                                      NOT NULL,
	`evaltype`               integer         DEFAULT '0'               NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	`formula`                varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (correlationid)
) ENGINE=InnoDB;
CREATE INDEX `correlation_1` ON `correlation` (`status`);
CREATE UNIQUE INDEX `correlation_2` ON `correlation` (`name`);
CREATE TABLE `corr_condition` (
	`corr_conditionid`       bigint unsigned                           NOT NULL,
	`correlationid`          bigint unsigned                           NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (corr_conditionid)
) ENGINE=InnoDB;
CREATE INDEX `corr_condition_1` ON `corr_condition` (`correlationid`);
CREATE TABLE `corr_condition_tag` (
	`corr_conditionid`       bigint unsigned                           NOT NULL,
	`tag`                    varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (corr_conditionid)
) ENGINE=InnoDB;
CREATE TABLE `corr_condition_group` (
	`corr_conditionid`       bigint unsigned                           NOT NULL,
	`operator`               integer         DEFAULT '0'               NOT NULL,
	`groupid`                bigint unsigned                           NOT NULL,
	PRIMARY KEY (corr_conditionid)
) ENGINE=InnoDB;
CREATE INDEX `corr_condition_group_1` ON `corr_condition_group` (`groupid`);
CREATE TABLE `corr_condition_tagpair` (
	`corr_conditionid`       bigint unsigned                           NOT NULL,
	`oldtag`                 varchar(255)    DEFAULT ''                NOT NULL,
	`newtag`                 varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (corr_conditionid)
) ENGINE=InnoDB;
CREATE TABLE `corr_condition_tagvalue` (
	`corr_conditionid`       bigint unsigned                           NOT NULL,
	`tag`                    varchar(255)    DEFAULT ''                NOT NULL,
	`operator`               integer         DEFAULT '0'               NOT NULL,
	`value`                  varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (corr_conditionid)
) ENGINE=InnoDB;
CREATE TABLE `corr_operation` (
	`corr_operationid`       bigint unsigned                           NOT NULL,
	`correlationid`          bigint unsigned                           NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (corr_operationid)
) ENGINE=InnoDB;
CREATE INDEX `corr_operation_1` ON `corr_operation` (`correlationid`);
CREATE TABLE `task` (
	`taskid`                 bigint unsigned                           NOT NULL,
	`type`                   integer                                   NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	`clock`                  integer         DEFAULT '0'               NOT NULL,
	`ttl`                    integer         DEFAULT '0'               NOT NULL,
	`proxy_hostid`           bigint unsigned                           NULL,
	PRIMARY KEY (taskid)
) ENGINE=InnoDB;
CREATE INDEX `task_1` ON `task` (`status`,`proxy_hostid`);
CREATE TABLE `task_close_problem` (
	`taskid`                 bigint unsigned                           NOT NULL,
	`acknowledgeid`          bigint unsigned                           NOT NULL,
	PRIMARY KEY (taskid)
) ENGINE=InnoDB;
CREATE TABLE `item_preproc` (
	`item_preprocid`         bigint unsigned                           NOT NULL,
	`itemid`                 bigint unsigned                           NOT NULL,
	`step`                   integer         DEFAULT '0'               NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	`params`                 text                                      NOT NULL,
	`error_handler`          integer         DEFAULT '0'               NOT NULL,
	`error_handler_params`   varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (item_preprocid)
) ENGINE=InnoDB;
CREATE INDEX `item_preproc_1` ON `item_preproc` (`itemid`,`step`);
CREATE TABLE `task_remote_command` (
	`taskid`                 bigint unsigned                           NOT NULL,
	`command_type`           integer         DEFAULT '0'               NOT NULL,
	`execute_on`             integer         DEFAULT '0'               NOT NULL,
	`port`                   integer         DEFAULT '0'               NOT NULL,
	`authtype`               integer         DEFAULT '0'               NOT NULL,
	`username`               varchar(64)     DEFAULT ''                NOT NULL,
	`password`               varchar(64)     DEFAULT ''                NOT NULL,
	`publickey`              varchar(64)     DEFAULT ''                NOT NULL,
	`privatekey`             varchar(64)     DEFAULT ''                NOT NULL,
	`command`                text                                      NOT NULL,
	`alertid`                bigint unsigned                           NULL,
	`parent_taskid`          bigint unsigned                           NOT NULL,
	`hostid`                 bigint unsigned                           NOT NULL,
	PRIMARY KEY (taskid)
) ENGINE=InnoDB;
CREATE TABLE `task_remote_command_result` (
	`taskid`                 bigint unsigned                           NOT NULL,
	`status`                 integer         DEFAULT '0'               NOT NULL,
	`parent_taskid`          bigint unsigned                           NOT NULL,
	`info`                   text                                      NOT NULL,
	PRIMARY KEY (taskid)
) ENGINE=InnoDB;
CREATE TABLE `task_acknowledge` (
	`taskid`                 bigint unsigned                           NOT NULL,
	`acknowledgeid`          bigint unsigned                           NOT NULL,
	PRIMARY KEY (taskid)
) ENGINE=InnoDB;
CREATE TABLE `sysmap_shape` (
	`sysmap_shapeid`         bigint unsigned                           NOT NULL,
	`sysmapid`               bigint unsigned                           NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	`x`                      integer         DEFAULT '0'               NOT NULL,
	`y`                      integer         DEFAULT '0'               NOT NULL,
	`width`                  integer         DEFAULT '200'             NOT NULL,
	`height`                 integer         DEFAULT '200'             NOT NULL,
	`text`                   text                                      NOT NULL,
	`font`                   integer         DEFAULT '9'               NOT NULL,
	`font_size`              integer         DEFAULT '11'              NOT NULL,
	`font_color`             varchar(6)      DEFAULT '000000'          NOT NULL,
	`text_halign`            integer         DEFAULT '0'               NOT NULL,
	`text_valign`            integer         DEFAULT '0'               NOT NULL,
	`border_type`            integer         DEFAULT '0'               NOT NULL,
	`border_width`           integer         DEFAULT '1'               NOT NULL,
	`border_color`           varchar(6)      DEFAULT '000000'          NOT NULL,
	`background_color`       varchar(6)      DEFAULT ''                NOT NULL,
	`zindex`                 integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (sysmap_shapeid)
) ENGINE=InnoDB;
CREATE INDEX `sysmap_shape_1` ON `sysmap_shape` (`sysmapid`);
CREATE TABLE `sysmap_element_trigger` (
	`selement_triggerid`     bigint unsigned                           NOT NULL,
	`selementid`             bigint unsigned                           NOT NULL,
	`triggerid`              bigint unsigned                           NOT NULL,
	PRIMARY KEY (selement_triggerid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `sysmap_element_trigger_1` ON `sysmap_element_trigger` (`selementid`,`triggerid`);
CREATE TABLE `httptest_field` (
	`httptest_fieldid`       bigint unsigned                           NOT NULL,
	`httptestid`             bigint unsigned                           NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	`name`                   varchar(255)    DEFAULT ''                NOT NULL,
	`value`                  text                                      NOT NULL,
	PRIMARY KEY (httptest_fieldid)
) ENGINE=InnoDB;
CREATE INDEX `httptest_field_1` ON `httptest_field` (`httptestid`);
CREATE TABLE `httpstep_field` (
	`httpstep_fieldid`       bigint unsigned                           NOT NULL,
	`httpstepid`             bigint unsigned                           NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	`name`                   varchar(255)    DEFAULT ''                NOT NULL,
	`value`                  text                                      NOT NULL,
	PRIMARY KEY (httpstep_fieldid)
) ENGINE=InnoDB;
CREATE INDEX `httpstep_field_1` ON `httpstep_field` (`httpstepid`);
CREATE TABLE `dashboard` (
	`dashboardid`            bigint unsigned                           NOT NULL,
	`name`                   varchar(255)                              NOT NULL,
	`userid`                 bigint unsigned                           NOT NULL,
	`private`                integer         DEFAULT '1'               NOT NULL,
	PRIMARY KEY (dashboardid)
) ENGINE=InnoDB;
CREATE TABLE `dashboard_user` (
	`dashboard_userid`       bigint unsigned                           NOT NULL,
	`dashboardid`            bigint unsigned                           NOT NULL,
	`userid`                 bigint unsigned                           NOT NULL,
	`permission`             integer         DEFAULT '2'               NOT NULL,
	PRIMARY KEY (dashboard_userid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `dashboard_user_1` ON `dashboard_user` (`dashboardid`,`userid`);
CREATE TABLE `dashboard_usrgrp` (
	`dashboard_usrgrpid`     bigint unsigned                           NOT NULL,
	`dashboardid`            bigint unsigned                           NOT NULL,
	`usrgrpid`               bigint unsigned                           NOT NULL,
	`permission`             integer         DEFAULT '2'               NOT NULL,
	PRIMARY KEY (dashboard_usrgrpid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `dashboard_usrgrp_1` ON `dashboard_usrgrp` (`dashboardid`,`usrgrpid`);
CREATE TABLE `widget` (
	`widgetid`               bigint unsigned                           NOT NULL,
	`dashboardid`            bigint unsigned                           NOT NULL,
	`type`                   varchar(255)    DEFAULT ''                NOT NULL,
	`name`                   varchar(255)    DEFAULT ''                NOT NULL,
	`x`                      integer         DEFAULT '0'               NOT NULL,
	`y`                      integer         DEFAULT '0'               NOT NULL,
	`width`                  integer         DEFAULT '1'               NOT NULL,
	`height`                 integer         DEFAULT '2'               NOT NULL,
	PRIMARY KEY (widgetid)
) ENGINE=InnoDB;
CREATE INDEX `widget_1` ON `widget` (`dashboardid`);
CREATE TABLE `widget_field` (
	`widget_fieldid`         bigint unsigned                           NOT NULL,
	`widgetid`               bigint unsigned                           NOT NULL,
	`type`                   integer         DEFAULT '0'               NOT NULL,
	`name`                   varchar(255)    DEFAULT ''                NOT NULL,
	`value_int`              integer         DEFAULT '0'               NOT NULL,
	`value_str`              varchar(255)    DEFAULT ''                NOT NULL,
	`value_groupid`          bigint unsigned                           NULL,
	`value_hostid`           bigint unsigned                           NULL,
	`value_itemid`           bigint unsigned                           NULL,
	`value_graphid`          bigint unsigned                           NULL,
	`value_sysmapid`         bigint unsigned                           NULL,
	PRIMARY KEY (widget_fieldid)
) ENGINE=InnoDB;
CREATE INDEX `widget_field_1` ON `widget_field` (`widgetid`);
CREATE INDEX `widget_field_2` ON `widget_field` (`value_groupid`);
CREATE INDEX `widget_field_3` ON `widget_field` (`value_hostid`);
CREATE INDEX `widget_field_4` ON `widget_field` (`value_itemid`);
CREATE INDEX `widget_field_5` ON `widget_field` (`value_graphid`);
CREATE INDEX `widget_field_6` ON `widget_field` (`value_sysmapid`);
CREATE TABLE `task_check_now` (
	`taskid`                 bigint unsigned                           NOT NULL,
	`itemid`                 bigint unsigned                           NOT NULL,
	PRIMARY KEY (taskid)
) ENGINE=InnoDB;
CREATE TABLE `event_suppress` (
	`event_suppressid`       bigint unsigned                           NOT NULL,
	`eventid`                bigint unsigned                           NOT NULL,
	`maintenanceid`          bigint unsigned                           NULL,
	`suppress_until`         integer         DEFAULT '0'               NOT NULL,
	PRIMARY KEY (event_suppressid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `event_suppress_1` ON `event_suppress` (`eventid`,`maintenanceid`);
CREATE INDEX `event_suppress_2` ON `event_suppress` (`suppress_until`);
CREATE INDEX `event_suppress_3` ON `event_suppress` (`maintenanceid`);
CREATE TABLE `maintenance_tag` (
	`maintenancetagid`       bigint unsigned                           NOT NULL,
	`maintenanceid`          bigint unsigned                           NOT NULL,
	`tag`                    varchar(255)    DEFAULT ''                NOT NULL,
	`operator`               integer         DEFAULT '2'               NOT NULL,
	`value`                  varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (maintenancetagid)
) ENGINE=InnoDB;
CREATE INDEX `maintenance_tag_1` ON `maintenance_tag` (`maintenanceid`);
CREATE TABLE `lld_macro_path` (
	`lld_macro_pathid`       bigint unsigned                           NOT NULL,
	`itemid`                 bigint unsigned                           NOT NULL,
	`lld_macro`              varchar(255)    DEFAULT ''                NOT NULL,
	`path`                   varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (lld_macro_pathid)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `lld_macro_path_1` ON `lld_macro_path` (`itemid`,`lld_macro`);
CREATE TABLE `host_tag` (
	`hosttagid`              bigint unsigned                           NOT NULL,
	`hostid`                 bigint unsigned                           NOT NULL,
	`tag`                    varchar(255)    DEFAULT ''                NOT NULL,
	`value`                  varchar(255)    DEFAULT ''                NOT NULL,
	PRIMARY KEY (hosttagid)
) ENGINE=InnoDB;
CREATE INDEX `host_tag_1` ON `host_tag` (`hostid`);
CREATE TABLE `dbversion` (
	`mandatory`              integer         DEFAULT '0'               NOT NULL,
	`optional`               integer         DEFAULT '0'               NOT NULL
) ENGINE=InnoDB;
INSERT INTO dbversion VALUES ('4020000','4020000');
ALTER TABLE `hosts` ADD CONSTRAINT `c_hosts_1` FOREIGN KEY (`proxy_hostid`) REFERENCES `hosts` (`hostid`);
ALTER TABLE `hosts` ADD CONSTRAINT `c_hosts_2` FOREIGN KEY (`maintenanceid`) REFERENCES `maintenances` (`maintenanceid`);
ALTER TABLE `hosts` ADD CONSTRAINT `c_hosts_3` FOREIGN KEY (`templateid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `group_prototype` ADD CONSTRAINT `c_group_prototype_1` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `group_prototype` ADD CONSTRAINT `c_group_prototype_2` FOREIGN KEY (`groupid`) REFERENCES `hstgrp` (`groupid`);
ALTER TABLE `group_prototype` ADD CONSTRAINT `c_group_prototype_3` FOREIGN KEY (`templateid`) REFERENCES `group_prototype` (`group_prototypeid`) ON DELETE CASCADE;
ALTER TABLE `group_discovery` ADD CONSTRAINT `c_group_discovery_1` FOREIGN KEY (`groupid`) REFERENCES `hstgrp` (`groupid`) ON DELETE CASCADE;
ALTER TABLE `group_discovery` ADD CONSTRAINT `c_group_discovery_2` FOREIGN KEY (`parent_group_prototypeid`) REFERENCES `group_prototype` (`group_prototypeid`);
ALTER TABLE `screens` ADD CONSTRAINT `c_screens_1` FOREIGN KEY (`templateid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `screens` ADD CONSTRAINT `c_screens_3` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`);
ALTER TABLE `screens_items` ADD CONSTRAINT `c_screens_items_1` FOREIGN KEY (`screenid`) REFERENCES `screens` (`screenid`) ON DELETE CASCADE;
ALTER TABLE `screen_user` ADD CONSTRAINT `c_screen_user_1` FOREIGN KEY (`screenid`) REFERENCES `screens` (`screenid`) ON DELETE CASCADE;
ALTER TABLE `screen_user` ADD CONSTRAINT `c_screen_user_2` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE;
ALTER TABLE `screen_usrgrp` ADD CONSTRAINT `c_screen_usrgrp_1` FOREIGN KEY (`screenid`) REFERENCES `screens` (`screenid`) ON DELETE CASCADE;
ALTER TABLE `screen_usrgrp` ADD CONSTRAINT `c_screen_usrgrp_2` FOREIGN KEY (`usrgrpid`) REFERENCES `usrgrp` (`usrgrpid`) ON DELETE CASCADE;
ALTER TABLE `slideshows` ADD CONSTRAINT `c_slideshows_3` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`);
ALTER TABLE `slideshow_user` ADD CONSTRAINT `c_slideshow_user_1` FOREIGN KEY (`slideshowid`) REFERENCES `slideshows` (`slideshowid`) ON DELETE CASCADE;
ALTER TABLE `slideshow_user` ADD CONSTRAINT `c_slideshow_user_2` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE;
ALTER TABLE `slideshow_usrgrp` ADD CONSTRAINT `c_slideshow_usrgrp_1` FOREIGN KEY (`slideshowid`) REFERENCES `slideshows` (`slideshowid`) ON DELETE CASCADE;
ALTER TABLE `slideshow_usrgrp` ADD CONSTRAINT `c_slideshow_usrgrp_2` FOREIGN KEY (`usrgrpid`) REFERENCES `usrgrp` (`usrgrpid`) ON DELETE CASCADE;
ALTER TABLE `slides` ADD CONSTRAINT `c_slides_1` FOREIGN KEY (`slideshowid`) REFERENCES `slideshows` (`slideshowid`) ON DELETE CASCADE;
ALTER TABLE `slides` ADD CONSTRAINT `c_slides_2` FOREIGN KEY (`screenid`) REFERENCES `screens` (`screenid`) ON DELETE CASCADE;
ALTER TABLE `drules` ADD CONSTRAINT `c_drules_1` FOREIGN KEY (`proxy_hostid`) REFERENCES `hosts` (`hostid`);
ALTER TABLE `dchecks` ADD CONSTRAINT `c_dchecks_1` FOREIGN KEY (`druleid`) REFERENCES `drules` (`druleid`) ON DELETE CASCADE;
ALTER TABLE `applications` ADD CONSTRAINT `c_applications_1` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `httptest` ADD CONSTRAINT `c_httptest_1` FOREIGN KEY (`applicationid`) REFERENCES `applications` (`applicationid`);
ALTER TABLE `httptest` ADD CONSTRAINT `c_httptest_2` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `httptest` ADD CONSTRAINT `c_httptest_3` FOREIGN KEY (`templateid`) REFERENCES `httptest` (`httptestid`) ON DELETE CASCADE;
ALTER TABLE `httpstep` ADD CONSTRAINT `c_httpstep_1` FOREIGN KEY (`httptestid`) REFERENCES `httptest` (`httptestid`) ON DELETE CASCADE;
ALTER TABLE `interface` ADD CONSTRAINT `c_interface_1` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `items` ADD CONSTRAINT `c_items_1` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `items` ADD CONSTRAINT `c_items_2` FOREIGN KEY (`templateid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE;
ALTER TABLE `items` ADD CONSTRAINT `c_items_3` FOREIGN KEY (`valuemapid`) REFERENCES `valuemaps` (`valuemapid`);
ALTER TABLE `items` ADD CONSTRAINT `c_items_4` FOREIGN KEY (`interfaceid`) REFERENCES `interface` (`interfaceid`);
ALTER TABLE `items` ADD CONSTRAINT `c_items_5` FOREIGN KEY (`master_itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE;
ALTER TABLE `httpstepitem` ADD CONSTRAINT `c_httpstepitem_1` FOREIGN KEY (`httpstepid`) REFERENCES `httpstep` (`httpstepid`) ON DELETE CASCADE;
ALTER TABLE `httpstepitem` ADD CONSTRAINT `c_httpstepitem_2` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE;
ALTER TABLE `httptestitem` ADD CONSTRAINT `c_httptestitem_1` FOREIGN KEY (`httptestid`) REFERENCES `httptest` (`httptestid`) ON DELETE CASCADE;
ALTER TABLE `httptestitem` ADD CONSTRAINT `c_httptestitem_2` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE;
ALTER TABLE `users_groups` ADD CONSTRAINT `c_users_groups_1` FOREIGN KEY (`usrgrpid`) REFERENCES `usrgrp` (`usrgrpid`) ON DELETE CASCADE;
ALTER TABLE `users_groups` ADD CONSTRAINT `c_users_groups_2` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE;
ALTER TABLE `scripts` ADD CONSTRAINT `c_scripts_1` FOREIGN KEY (`usrgrpid`) REFERENCES `usrgrp` (`usrgrpid`);
ALTER TABLE `scripts` ADD CONSTRAINT `c_scripts_2` FOREIGN KEY (`groupid`) REFERENCES `hstgrp` (`groupid`);
ALTER TABLE `operations` ADD CONSTRAINT `c_operations_1` FOREIGN KEY (`actionid`) REFERENCES `actions` (`actionid`) ON DELETE CASCADE;
ALTER TABLE `opmessage` ADD CONSTRAINT `c_opmessage_1` FOREIGN KEY (`operationid`) REFERENCES `operations` (`operationid`) ON DELETE CASCADE;
ALTER TABLE `opmessage` ADD CONSTRAINT `c_opmessage_2` FOREIGN KEY (`mediatypeid`) REFERENCES `media_type` (`mediatypeid`);
ALTER TABLE `opmessage_grp` ADD CONSTRAINT `c_opmessage_grp_1` FOREIGN KEY (`operationid`) REFERENCES `operations` (`operationid`) ON DELETE CASCADE;
ALTER TABLE `opmessage_grp` ADD CONSTRAINT `c_opmessage_grp_2` FOREIGN KEY (`usrgrpid`) REFERENCES `usrgrp` (`usrgrpid`);
ALTER TABLE `opmessage_usr` ADD CONSTRAINT `c_opmessage_usr_1` FOREIGN KEY (`operationid`) REFERENCES `operations` (`operationid`) ON DELETE CASCADE;
ALTER TABLE `opmessage_usr` ADD CONSTRAINT `c_opmessage_usr_2` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`);
ALTER TABLE `opcommand` ADD CONSTRAINT `c_opcommand_1` FOREIGN KEY (`operationid`) REFERENCES `operations` (`operationid`) ON DELETE CASCADE;
ALTER TABLE `opcommand` ADD CONSTRAINT `c_opcommand_2` FOREIGN KEY (`scriptid`) REFERENCES `scripts` (`scriptid`);
ALTER TABLE `opcommand_hst` ADD CONSTRAINT `c_opcommand_hst_1` FOREIGN KEY (`operationid`) REFERENCES `operations` (`operationid`) ON DELETE CASCADE;
ALTER TABLE `opcommand_hst` ADD CONSTRAINT `c_opcommand_hst_2` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`);
ALTER TABLE `opcommand_grp` ADD CONSTRAINT `c_opcommand_grp_1` FOREIGN KEY (`operationid`) REFERENCES `operations` (`operationid`) ON DELETE CASCADE;
ALTER TABLE `opcommand_grp` ADD CONSTRAINT `c_opcommand_grp_2` FOREIGN KEY (`groupid`) REFERENCES `hstgrp` (`groupid`);
ALTER TABLE `opgroup` ADD CONSTRAINT `c_opgroup_1` FOREIGN KEY (`operationid`) REFERENCES `operations` (`operationid`) ON DELETE CASCADE;
ALTER TABLE `opgroup` ADD CONSTRAINT `c_opgroup_2` FOREIGN KEY (`groupid`) REFERENCES `hstgrp` (`groupid`);
ALTER TABLE `optemplate` ADD CONSTRAINT `c_optemplate_1` FOREIGN KEY (`operationid`) REFERENCES `operations` (`operationid`) ON DELETE CASCADE;
ALTER TABLE `optemplate` ADD CONSTRAINT `c_optemplate_2` FOREIGN KEY (`templateid`) REFERENCES `hosts` (`hostid`);
ALTER TABLE `opconditions` ADD CONSTRAINT `c_opconditions_1` FOREIGN KEY (`operationid`) REFERENCES `operations` (`operationid`) ON DELETE CASCADE;
ALTER TABLE `conditions` ADD CONSTRAINT `c_conditions_1` FOREIGN KEY (`actionid`) REFERENCES `actions` (`actionid`) ON DELETE CASCADE;
ALTER TABLE `config` ADD CONSTRAINT `c_config_1` FOREIGN KEY (`alert_usrgrpid`) REFERENCES `usrgrp` (`usrgrpid`);
ALTER TABLE `config` ADD CONSTRAINT `c_config_2` FOREIGN KEY (`discovery_groupid`) REFERENCES `hstgrp` (`groupid`);
ALTER TABLE `triggers` ADD CONSTRAINT `c_triggers_1` FOREIGN KEY (`templateid`) REFERENCES `triggers` (`triggerid`) ON DELETE CASCADE;
ALTER TABLE `trigger_depends` ADD CONSTRAINT `c_trigger_depends_1` FOREIGN KEY (`triggerid_down`) REFERENCES `triggers` (`triggerid`) ON DELETE CASCADE;
ALTER TABLE `trigger_depends` ADD CONSTRAINT `c_trigger_depends_2` FOREIGN KEY (`triggerid_up`) REFERENCES `triggers` (`triggerid`) ON DELETE CASCADE;
ALTER TABLE `functions` ADD CONSTRAINT `c_functions_1` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE;
ALTER TABLE `functions` ADD CONSTRAINT `c_functions_2` FOREIGN KEY (`triggerid`) REFERENCES `triggers` (`triggerid`) ON DELETE CASCADE;
ALTER TABLE `graphs` ADD CONSTRAINT `c_graphs_1` FOREIGN KEY (`templateid`) REFERENCES `graphs` (`graphid`) ON DELETE CASCADE;
ALTER TABLE `graphs` ADD CONSTRAINT `c_graphs_2` FOREIGN KEY (`ymin_itemid`) REFERENCES `items` (`itemid`);
ALTER TABLE `graphs` ADD CONSTRAINT `c_graphs_3` FOREIGN KEY (`ymax_itemid`) REFERENCES `items` (`itemid`);
ALTER TABLE `graphs_items` ADD CONSTRAINT `c_graphs_items_1` FOREIGN KEY (`graphid`) REFERENCES `graphs` (`graphid`) ON DELETE CASCADE;
ALTER TABLE `graphs_items` ADD CONSTRAINT `c_graphs_items_2` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE;
ALTER TABLE `hostmacro` ADD CONSTRAINT `c_hostmacro_1` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `hosts_groups` ADD CONSTRAINT `c_hosts_groups_1` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `hosts_groups` ADD CONSTRAINT `c_hosts_groups_2` FOREIGN KEY (`groupid`) REFERENCES `hstgrp` (`groupid`) ON DELETE CASCADE;
ALTER TABLE `hosts_templates` ADD CONSTRAINT `c_hosts_templates_1` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `hosts_templates` ADD CONSTRAINT `c_hosts_templates_2` FOREIGN KEY (`templateid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `items_applications` ADD CONSTRAINT `c_items_applications_1` FOREIGN KEY (`applicationid`) REFERENCES `applications` (`applicationid`) ON DELETE CASCADE;
ALTER TABLE `items_applications` ADD CONSTRAINT `c_items_applications_2` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE;
ALTER TABLE `mappings` ADD CONSTRAINT `c_mappings_1` FOREIGN KEY (`valuemapid`) REFERENCES `valuemaps` (`valuemapid`) ON DELETE CASCADE;
ALTER TABLE `media` ADD CONSTRAINT `c_media_1` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE;
ALTER TABLE `media` ADD CONSTRAINT `c_media_2` FOREIGN KEY (`mediatypeid`) REFERENCES `media_type` (`mediatypeid`) ON DELETE CASCADE;
ALTER TABLE `rights` ADD CONSTRAINT `c_rights_1` FOREIGN KEY (`groupid`) REFERENCES `usrgrp` (`usrgrpid`) ON DELETE CASCADE;
ALTER TABLE `rights` ADD CONSTRAINT `c_rights_2` FOREIGN KEY (`id`) REFERENCES `hstgrp` (`groupid`) ON DELETE CASCADE;
ALTER TABLE `services` ADD CONSTRAINT `c_services_1` FOREIGN KEY (`triggerid`) REFERENCES `triggers` (`triggerid`) ON DELETE CASCADE;
ALTER TABLE `services_links` ADD CONSTRAINT `c_services_links_1` FOREIGN KEY (`serviceupid`) REFERENCES `services` (`serviceid`) ON DELETE CASCADE;
ALTER TABLE `services_links` ADD CONSTRAINT `c_services_links_2` FOREIGN KEY (`servicedownid`) REFERENCES `services` (`serviceid`) ON DELETE CASCADE;
ALTER TABLE `services_times` ADD CONSTRAINT `c_services_times_1` FOREIGN KEY (`serviceid`) REFERENCES `services` (`serviceid`) ON DELETE CASCADE;
ALTER TABLE `icon_map` ADD CONSTRAINT `c_icon_map_1` FOREIGN KEY (`default_iconid`) REFERENCES `images` (`imageid`);
ALTER TABLE `icon_mapping` ADD CONSTRAINT `c_icon_mapping_1` FOREIGN KEY (`iconmapid`) REFERENCES `icon_map` (`iconmapid`) ON DELETE CASCADE;
ALTER TABLE `icon_mapping` ADD CONSTRAINT `c_icon_mapping_2` FOREIGN KEY (`iconid`) REFERENCES `images` (`imageid`);
ALTER TABLE `sysmaps` ADD CONSTRAINT `c_sysmaps_1` FOREIGN KEY (`backgroundid`) REFERENCES `images` (`imageid`);
ALTER TABLE `sysmaps` ADD CONSTRAINT `c_sysmaps_2` FOREIGN KEY (`iconmapid`) REFERENCES `icon_map` (`iconmapid`);
ALTER TABLE `sysmaps` ADD CONSTRAINT `c_sysmaps_3` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`);
ALTER TABLE `sysmaps_elements` ADD CONSTRAINT `c_sysmaps_elements_1` FOREIGN KEY (`sysmapid`) REFERENCES `sysmaps` (`sysmapid`) ON DELETE CASCADE;
ALTER TABLE `sysmaps_elements` ADD CONSTRAINT `c_sysmaps_elements_2` FOREIGN KEY (`iconid_off`) REFERENCES `images` (`imageid`);
ALTER TABLE `sysmaps_elements` ADD CONSTRAINT `c_sysmaps_elements_3` FOREIGN KEY (`iconid_on`) REFERENCES `images` (`imageid`);
ALTER TABLE `sysmaps_elements` ADD CONSTRAINT `c_sysmaps_elements_4` FOREIGN KEY (`iconid_disabled`) REFERENCES `images` (`imageid`);
ALTER TABLE `sysmaps_elements` ADD CONSTRAINT `c_sysmaps_elements_5` FOREIGN KEY (`iconid_maintenance`) REFERENCES `images` (`imageid`);
ALTER TABLE `sysmaps_links` ADD CONSTRAINT `c_sysmaps_links_1` FOREIGN KEY (`sysmapid`) REFERENCES `sysmaps` (`sysmapid`) ON DELETE CASCADE;
ALTER TABLE `sysmaps_links` ADD CONSTRAINT `c_sysmaps_links_2` FOREIGN KEY (`selementid1`) REFERENCES `sysmaps_elements` (`selementid`) ON DELETE CASCADE;
ALTER TABLE `sysmaps_links` ADD CONSTRAINT `c_sysmaps_links_3` FOREIGN KEY (`selementid2`) REFERENCES `sysmaps_elements` (`selementid`) ON DELETE CASCADE;
ALTER TABLE `sysmaps_link_triggers` ADD CONSTRAINT `c_sysmaps_link_triggers_1` FOREIGN KEY (`linkid`) REFERENCES `sysmaps_links` (`linkid`) ON DELETE CASCADE;
ALTER TABLE `sysmaps_link_triggers` ADD CONSTRAINT `c_sysmaps_link_triggers_2` FOREIGN KEY (`triggerid`) REFERENCES `triggers` (`triggerid`) ON DELETE CASCADE;
ALTER TABLE `sysmap_element_url` ADD CONSTRAINT `c_sysmap_element_url_1` FOREIGN KEY (`selementid`) REFERENCES `sysmaps_elements` (`selementid`) ON DELETE CASCADE;
ALTER TABLE `sysmap_url` ADD CONSTRAINT `c_sysmap_url_1` FOREIGN KEY (`sysmapid`) REFERENCES `sysmaps` (`sysmapid`) ON DELETE CASCADE;
ALTER TABLE `sysmap_user` ADD CONSTRAINT `c_sysmap_user_1` FOREIGN KEY (`sysmapid`) REFERENCES `sysmaps` (`sysmapid`) ON DELETE CASCADE;
ALTER TABLE `sysmap_user` ADD CONSTRAINT `c_sysmap_user_2` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE;
ALTER TABLE `sysmap_usrgrp` ADD CONSTRAINT `c_sysmap_usrgrp_1` FOREIGN KEY (`sysmapid`) REFERENCES `sysmaps` (`sysmapid`) ON DELETE CASCADE;
ALTER TABLE `sysmap_usrgrp` ADD CONSTRAINT `c_sysmap_usrgrp_2` FOREIGN KEY (`usrgrpid`) REFERENCES `usrgrp` (`usrgrpid`) ON DELETE CASCADE;
ALTER TABLE `maintenances_hosts` ADD CONSTRAINT `c_maintenances_hosts_1` FOREIGN KEY (`maintenanceid`) REFERENCES `maintenances` (`maintenanceid`) ON DELETE CASCADE;
ALTER TABLE `maintenances_hosts` ADD CONSTRAINT `c_maintenances_hosts_2` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `maintenances_groups` ADD CONSTRAINT `c_maintenances_groups_1` FOREIGN KEY (`maintenanceid`) REFERENCES `maintenances` (`maintenanceid`) ON DELETE CASCADE;
ALTER TABLE `maintenances_groups` ADD CONSTRAINT `c_maintenances_groups_2` FOREIGN KEY (`groupid`) REFERENCES `hstgrp` (`groupid`) ON DELETE CASCADE;
ALTER TABLE `maintenances_windows` ADD CONSTRAINT `c_maintenances_windows_1` FOREIGN KEY (`maintenanceid`) REFERENCES `maintenances` (`maintenanceid`) ON DELETE CASCADE;
ALTER TABLE `maintenances_windows` ADD CONSTRAINT `c_maintenances_windows_2` FOREIGN KEY (`timeperiodid`) REFERENCES `timeperiods` (`timeperiodid`) ON DELETE CASCADE;
ALTER TABLE `expressions` ADD CONSTRAINT `c_expressions_1` FOREIGN KEY (`regexpid`) REFERENCES `regexps` (`regexpid`) ON DELETE CASCADE;
ALTER TABLE `alerts` ADD CONSTRAINT `c_alerts_1` FOREIGN KEY (`actionid`) REFERENCES `actions` (`actionid`) ON DELETE CASCADE;
ALTER TABLE `alerts` ADD CONSTRAINT `c_alerts_2` FOREIGN KEY (`eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE;
ALTER TABLE `alerts` ADD CONSTRAINT `c_alerts_3` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE;
ALTER TABLE `alerts` ADD CONSTRAINT `c_alerts_4` FOREIGN KEY (`mediatypeid`) REFERENCES `media_type` (`mediatypeid`) ON DELETE CASCADE;
ALTER TABLE `alerts` ADD CONSTRAINT `c_alerts_5` FOREIGN KEY (`p_eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE;
ALTER TABLE `alerts` ADD CONSTRAINT `c_alerts_6` FOREIGN KEY (`acknowledgeid`) REFERENCES `acknowledges` (`acknowledgeid`) ON DELETE CASCADE;
ALTER TABLE `acknowledges` ADD CONSTRAINT `c_acknowledges_1` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE;
ALTER TABLE `acknowledges` ADD CONSTRAINT `c_acknowledges_2` FOREIGN KEY (`eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE;
ALTER TABLE `auditlog` ADD CONSTRAINT `c_auditlog_1` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE;
ALTER TABLE `auditlog_details` ADD CONSTRAINT `c_auditlog_details_1` FOREIGN KEY (`auditid`) REFERENCES `auditlog` (`auditid`) ON DELETE CASCADE;
ALTER TABLE `service_alarms` ADD CONSTRAINT `c_service_alarms_1` FOREIGN KEY (`serviceid`) REFERENCES `services` (`serviceid`) ON DELETE CASCADE;
ALTER TABLE `autoreg_host` ADD CONSTRAINT `c_autoreg_host_1` FOREIGN KEY (`proxy_hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `dhosts` ADD CONSTRAINT `c_dhosts_1` FOREIGN KEY (`druleid`) REFERENCES `drules` (`druleid`) ON DELETE CASCADE;
ALTER TABLE `dservices` ADD CONSTRAINT `c_dservices_1` FOREIGN KEY (`dhostid`) REFERENCES `dhosts` (`dhostid`) ON DELETE CASCADE;
ALTER TABLE `dservices` ADD CONSTRAINT `c_dservices_2` FOREIGN KEY (`dcheckid`) REFERENCES `dchecks` (`dcheckid`) ON DELETE CASCADE;
ALTER TABLE `graph_discovery` ADD CONSTRAINT `c_graph_discovery_1` FOREIGN KEY (`graphid`) REFERENCES `graphs` (`graphid`) ON DELETE CASCADE;
ALTER TABLE `graph_discovery` ADD CONSTRAINT `c_graph_discovery_2` FOREIGN KEY (`parent_graphid`) REFERENCES `graphs` (`graphid`);
ALTER TABLE `host_inventory` ADD CONSTRAINT `c_host_inventory_1` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `item_discovery` ADD CONSTRAINT `c_item_discovery_1` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE;
ALTER TABLE `item_discovery` ADD CONSTRAINT `c_item_discovery_2` FOREIGN KEY (`parent_itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE;
ALTER TABLE `host_discovery` ADD CONSTRAINT `c_host_discovery_1` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `host_discovery` ADD CONSTRAINT `c_host_discovery_2` FOREIGN KEY (`parent_hostid`) REFERENCES `hosts` (`hostid`);
ALTER TABLE `host_discovery` ADD CONSTRAINT `c_host_discovery_3` FOREIGN KEY (`parent_itemid`) REFERENCES `items` (`itemid`);
ALTER TABLE `interface_discovery` ADD CONSTRAINT `c_interface_discovery_1` FOREIGN KEY (`interfaceid`) REFERENCES `interface` (`interfaceid`) ON DELETE CASCADE;
ALTER TABLE `interface_discovery` ADD CONSTRAINT `c_interface_discovery_2` FOREIGN KEY (`parent_interfaceid`) REFERENCES `interface` (`interfaceid`) ON DELETE CASCADE;
ALTER TABLE `profiles` ADD CONSTRAINT `c_profiles_1` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE;
ALTER TABLE `sessions` ADD CONSTRAINT `c_sessions_1` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE;
ALTER TABLE `trigger_discovery` ADD CONSTRAINT `c_trigger_discovery_1` FOREIGN KEY (`triggerid`) REFERENCES `triggers` (`triggerid`) ON DELETE CASCADE;
ALTER TABLE `trigger_discovery` ADD CONSTRAINT `c_trigger_discovery_2` FOREIGN KEY (`parent_triggerid`) REFERENCES `triggers` (`triggerid`);
ALTER TABLE `application_template` ADD CONSTRAINT `c_application_template_1` FOREIGN KEY (`applicationid`) REFERENCES `applications` (`applicationid`) ON DELETE CASCADE;
ALTER TABLE `application_template` ADD CONSTRAINT `c_application_template_2` FOREIGN KEY (`templateid`) REFERENCES `applications` (`applicationid`) ON DELETE CASCADE;
ALTER TABLE `item_condition` ADD CONSTRAINT `c_item_condition_1` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE;
ALTER TABLE `application_prototype` ADD CONSTRAINT `c_application_prototype_1` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE;
ALTER TABLE `application_prototype` ADD CONSTRAINT `c_application_prototype_2` FOREIGN KEY (`templateid`) REFERENCES `application_prototype` (`application_prototypeid`) ON DELETE CASCADE;
ALTER TABLE `item_application_prototype` ADD CONSTRAINT `c_item_application_prototype_1` FOREIGN KEY (`application_prototypeid`) REFERENCES `application_prototype` (`application_prototypeid`) ON DELETE CASCADE;
ALTER TABLE `item_application_prototype` ADD CONSTRAINT `c_item_application_prototype_2` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE;
ALTER TABLE `application_discovery` ADD CONSTRAINT `c_application_discovery_1` FOREIGN KEY (`applicationid`) REFERENCES `applications` (`applicationid`) ON DELETE CASCADE;
ALTER TABLE `application_discovery` ADD CONSTRAINT `c_application_discovery_2` FOREIGN KEY (`application_prototypeid`) REFERENCES `application_prototype` (`application_prototypeid`) ON DELETE CASCADE;
ALTER TABLE `opinventory` ADD CONSTRAINT `c_opinventory_1` FOREIGN KEY (`operationid`) REFERENCES `operations` (`operationid`) ON DELETE CASCADE;
ALTER TABLE `trigger_tag` ADD CONSTRAINT `c_trigger_tag_1` FOREIGN KEY (`triggerid`) REFERENCES `triggers` (`triggerid`) ON DELETE CASCADE;
ALTER TABLE `event_tag` ADD CONSTRAINT `c_event_tag_1` FOREIGN KEY (`eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE;
ALTER TABLE `problem` ADD CONSTRAINT `c_problem_1` FOREIGN KEY (`eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE;
ALTER TABLE `problem` ADD CONSTRAINT `c_problem_2` FOREIGN KEY (`r_eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE;
ALTER TABLE `problem_tag` ADD CONSTRAINT `c_problem_tag_1` FOREIGN KEY (`eventid`) REFERENCES `problem` (`eventid`) ON DELETE CASCADE;
ALTER TABLE `tag_filter` ADD CONSTRAINT `c_tag_filter_1` FOREIGN KEY (`usrgrpid`) REFERENCES `usrgrp` (`usrgrpid`) ON DELETE CASCADE;
ALTER TABLE `tag_filter` ADD CONSTRAINT `c_tag_filter_2` FOREIGN KEY (`groupid`) REFERENCES `hstgrp` (`groupid`) ON DELETE CASCADE;
ALTER TABLE `event_recovery` ADD CONSTRAINT `c_event_recovery_1` FOREIGN KEY (`eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE;
ALTER TABLE `event_recovery` ADD CONSTRAINT `c_event_recovery_2` FOREIGN KEY (`r_eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE;
ALTER TABLE `event_recovery` ADD CONSTRAINT `c_event_recovery_3` FOREIGN KEY (`c_eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE;
ALTER TABLE `corr_condition` ADD CONSTRAINT `c_corr_condition_1` FOREIGN KEY (`correlationid`) REFERENCES `correlation` (`correlationid`) ON DELETE CASCADE;
ALTER TABLE `corr_condition_tag` ADD CONSTRAINT `c_corr_condition_tag_1` FOREIGN KEY (`corr_conditionid`) REFERENCES `corr_condition` (`corr_conditionid`) ON DELETE CASCADE;
ALTER TABLE `corr_condition_group` ADD CONSTRAINT `c_corr_condition_group_1` FOREIGN KEY (`corr_conditionid`) REFERENCES `corr_condition` (`corr_conditionid`) ON DELETE CASCADE;
ALTER TABLE `corr_condition_group` ADD CONSTRAINT `c_corr_condition_group_2` FOREIGN KEY (`groupid`) REFERENCES `hstgrp` (`groupid`);
ALTER TABLE `corr_condition_tagpair` ADD CONSTRAINT `c_corr_condition_tagpair_1` FOREIGN KEY (`corr_conditionid`) REFERENCES `corr_condition` (`corr_conditionid`) ON DELETE CASCADE;
ALTER TABLE `corr_condition_tagvalue` ADD CONSTRAINT `c_corr_condition_tagvalue_1` FOREIGN KEY (`corr_conditionid`) REFERENCES `corr_condition` (`corr_conditionid`) ON DELETE CASCADE;
ALTER TABLE `corr_operation` ADD CONSTRAINT `c_corr_operation_1` FOREIGN KEY (`correlationid`) REFERENCES `correlation` (`correlationid`) ON DELETE CASCADE;
ALTER TABLE `task` ADD CONSTRAINT `c_task_1` FOREIGN KEY (`proxy_hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `task_close_problem` ADD CONSTRAINT `c_task_close_problem_1` FOREIGN KEY (`taskid`) REFERENCES `task` (`taskid`) ON DELETE CASCADE;
ALTER TABLE `item_preproc` ADD CONSTRAINT `c_item_preproc_1` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE;
ALTER TABLE `task_remote_command` ADD CONSTRAINT `c_task_remote_command_1` FOREIGN KEY (`taskid`) REFERENCES `task` (`taskid`) ON DELETE CASCADE;
ALTER TABLE `task_remote_command_result` ADD CONSTRAINT `c_task_remote_command_result_1` FOREIGN KEY (`taskid`) REFERENCES `task` (`taskid`) ON DELETE CASCADE;
ALTER TABLE `task_acknowledge` ADD CONSTRAINT `c_task_acknowledge_1` FOREIGN KEY (`taskid`) REFERENCES `task` (`taskid`) ON DELETE CASCADE;
ALTER TABLE `sysmap_shape` ADD CONSTRAINT `c_sysmap_shape_1` FOREIGN KEY (`sysmapid`) REFERENCES `sysmaps` (`sysmapid`) ON DELETE CASCADE;
ALTER TABLE `sysmap_element_trigger` ADD CONSTRAINT `c_sysmap_element_trigger_1` FOREIGN KEY (`selementid`) REFERENCES `sysmaps_elements` (`selementid`) ON DELETE CASCADE;
ALTER TABLE `sysmap_element_trigger` ADD CONSTRAINT `c_sysmap_element_trigger_2` FOREIGN KEY (`triggerid`) REFERENCES `triggers` (`triggerid`) ON DELETE CASCADE;
ALTER TABLE `httptest_field` ADD CONSTRAINT `c_httptest_field_1` FOREIGN KEY (`httptestid`) REFERENCES `httptest` (`httptestid`) ON DELETE CASCADE;
ALTER TABLE `httpstep_field` ADD CONSTRAINT `c_httpstep_field_1` FOREIGN KEY (`httpstepid`) REFERENCES `httpstep` (`httpstepid`) ON DELETE CASCADE;
ALTER TABLE `dashboard` ADD CONSTRAINT `c_dashboard_1` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`);
ALTER TABLE `dashboard_user` ADD CONSTRAINT `c_dashboard_user_1` FOREIGN KEY (`dashboardid`) REFERENCES `dashboard` (`dashboardid`) ON DELETE CASCADE;
ALTER TABLE `dashboard_user` ADD CONSTRAINT `c_dashboard_user_2` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE;
ALTER TABLE `dashboard_usrgrp` ADD CONSTRAINT `c_dashboard_usrgrp_1` FOREIGN KEY (`dashboardid`) REFERENCES `dashboard` (`dashboardid`) ON DELETE CASCADE;
ALTER TABLE `dashboard_usrgrp` ADD CONSTRAINT `c_dashboard_usrgrp_2` FOREIGN KEY (`usrgrpid`) REFERENCES `usrgrp` (`usrgrpid`) ON DELETE CASCADE;
ALTER TABLE `widget` ADD CONSTRAINT `c_widget_1` FOREIGN KEY (`dashboardid`) REFERENCES `dashboard` (`dashboardid`) ON DELETE CASCADE;
ALTER TABLE `widget_field` ADD CONSTRAINT `c_widget_field_1` FOREIGN KEY (`widgetid`) REFERENCES `widget` (`widgetid`) ON DELETE CASCADE;
ALTER TABLE `widget_field` ADD CONSTRAINT `c_widget_field_2` FOREIGN KEY (`value_groupid`) REFERENCES `hstgrp` (`groupid`) ON DELETE CASCADE;
ALTER TABLE `widget_field` ADD CONSTRAINT `c_widget_field_3` FOREIGN KEY (`value_hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
ALTER TABLE `widget_field` ADD CONSTRAINT `c_widget_field_4` FOREIGN KEY (`value_itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE;
ALTER TABLE `widget_field` ADD CONSTRAINT `c_widget_field_5` FOREIGN KEY (`value_graphid`) REFERENCES `graphs` (`graphid`) ON DELETE CASCADE;
ALTER TABLE `widget_field` ADD CONSTRAINT `c_widget_field_6` FOREIGN KEY (`value_sysmapid`) REFERENCES `sysmaps` (`sysmapid`) ON DELETE CASCADE;
ALTER TABLE `task_check_now` ADD CONSTRAINT `c_task_check_now_1` FOREIGN KEY (`taskid`) REFERENCES `task` (`taskid`) ON DELETE CASCADE;
ALTER TABLE `event_suppress` ADD CONSTRAINT `c_event_suppress_1` FOREIGN KEY (`eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE;
ALTER TABLE `event_suppress` ADD CONSTRAINT `c_event_suppress_2` FOREIGN KEY (`maintenanceid`) REFERENCES `maintenances` (`maintenanceid`) ON DELETE CASCADE;
ALTER TABLE `maintenance_tag` ADD CONSTRAINT `c_maintenance_tag_1` FOREIGN KEY (`maintenanceid`) REFERENCES `maintenances` (`maintenanceid`) ON DELETE CASCADE;
ALTER TABLE `lld_macro_path` ADD CONSTRAINT `c_lld_macro_path_1` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE;
ALTER TABLE `host_tag` ADD CONSTRAINT `c_host_tag_1` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE;
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (1,1,'Cloud_(128)',0x[encoded data, 10012 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (2,1,'Cloud_(24)',0x89504E470D0A1A0A0000000D49484452000000180000000D0806000000B36CAED00000000473424954080808087C086488000000097048597300000298000002980136D347DF0000001974455874536F667477617265007777772E696E6B73636170652E6F72679BEE3C1A0000021C4944415438CBAD92DB4B14511CC74F2A2122450F3D083D2CF8DE63F4120C11FE0783F8D67B10F66445D06C2F6D5941598A6B4B86CC2E66256E8CAD542666175BD3DA09476D6FCDDE9CBDCFEECEACB397F975CEC452C9AA90FB851F7338FCE6FBF95D0E0200B45320C4345114D37AE1D6E34EB3F9451BBE68DA2DBFAE477D6374E0CA3DC789A7B36EE91D1FD03FACFE04F6F5A2D2EF98E1FB869CC7F70D181873767FF3862B412903DE680A845002F8A0042BBE18D8B8F73233E83A8910DD7CB1FF51877970A27DB7CEEA544F1FFC22F80BD9421192B202B1741E4209190218F6C380C5C131BBA44DCE2F2B9FD64478B3B2AEDF665D8B16EBC4E13D016434D71ED82FE13354AA552896CA902F6A90C1B0C45F30414C827B238CBF71F0043661D91785EB63D31CF97F470059A8C974B675DCB520E83AFCA37205C3340C53FFC0564509C3B2E0DF4CC3462409339F85D2F901F6505D00459F6B7F3835C70BC15855CA168CD110D37AAAC1327915D238E2383F9ACA01D9977964AAB7ABA7AF0351544BAD1B632CA3DC025FDD5EF61E22D9250C53B512E4D42D88604838993360EB784F77598E25DEC872DF75D4E30D95611FD27171A42B75EB372C853B8BA464B00C3B8F21FBF4C7337241854689C0B47205140CB33A5E9D3696FBD6FD5D8406CB27C65486996B31963C34CE757D5DF3CB8D3096F38AFE727EC973C736796ADB33A59B7BAFDA4C96E127F4CD91673DFF15D6E7DD976FD88F90A9D47C7F0129D2E0172D250F240000000049454E44AE426082);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (3,1,'Cloud_(48)',0x89504E470D0A1A0A0000000D49484452000000300000001A0806000000F135DFD70000000473424954080808087C0864880000000970485973000005310000053101B7ED28520000001974455874536F667477617265007777772E696E6B73636170652E6F72679BEE3C1A000005794944415458C3D5980B4C935714C7AFA82C6CF335E6962C4E32401E4137591337F6C874A81B4F751B922D19C4647318936599899A4D863093395FC8700EE7467460419D30C74307CA43606AA55A942ACFB640A12D2DB4E551DAD2F6ECDCEFFB982D0222C3514F72494AF27DDFF99D73CFFF9C7B090090892EB46984EC74210151AE8417F138F10E798C90A8E9ECFFC9B4FFF2EE71FB30A187A2D049DFC859E8F002E215B6782E2F6A45CC8E435F7EB8FDE0A6159FC48712FFF045C427E26906EC21833C78C4791B67928088851BBE4AD9F267A548562CAC3754D4CA6C976A65507A530A85D7EA6D274A84863DFC6241F067BBDE2301EF3C4581A71C80717E41949BABDF9A25B9A5D7046299CA266EE9845A990A6E4A95206A56C0F5A60EB8D6D00E57EBE550764B0A5965A2C184F4FC32E21FEA4178BC99530B80CEBB2F8B7E45209628A42A2D4814DDD0D4D1050DED1AA86B53C3EDD64EB885303508730361844DED08238773C206D87BB2443AFBD5F7BD2904571F2E4CADD02DB67CF90CF6F7C4B6DA38A38F1FF17DD7B75C78BB49A9ED858EAE1E906BF4D0DAA9031907D38830F5720DDC41189A19164681301D508ED9D89D75A18178626DE0F6C3FAF1F5581EF35A5C525ADCEA8D8991AE2FAFF367B61AC24C3A0013312CC8ED07D2F76BF47DB6EE5E0368F4FDD0A9EB0365370BD386302D084333D37C0F8C0A6194701E6B233E2DE76AF289C2BFB38B058AB29AE6C12B775AE1925866FBBDEC86FEC0C9E2D297C2BF08A44A36B900F8C259BC0FDEE850770F184C66E81B30418FC108BABE01188251218C0261DA298C9A8351DAC3A811A6134E55D4323035123633C246769B5DA96B83AADBAD7024AFAA6D43E2D1F50F522FF78FFEE2C867F7FD9A9B69B3D9C062B58279D00246F320188C1C4CBF11B408D3D56300F598305D58D812A814CBE00ED6CB50664408731D61AA11468030074F97D67BACFCE8055A179301E082DBC7EFAF4A6113D8D9108C09610610A61F617A11463F1C46EB0843EBA54050CFC03462F1D3CCD0E2AF6DE1940C61AAC42DD66D69B9C768639C30C0BF1D165F32C33F729546AB37C328664598410B0763BA3F4C89A8196174D0823052252A998253323B9823F955F279BCF50BC7A34CF73A4EA5CD6BF53334F26FC6C4C7261DCDA990E0877A0D26B89F8D08637084B9823D424595AC9B533235A764CABBB25C545D670CFE74D7AA21791D0BC4CE798CB8EFEBB3C8A2D0A5DFFF56589C5D22D495DF9458695A69BA69B19D1736321F1B8F8D0643A3AEED1D004D0FA764F6B2CCC150F5DABC376337CAED73CCC23AC4C03EC9C8F93098BB91F75C396749C4A6B567CA840A1AA9D18CAA0F75E641CC6AE560CC16E659BA7A1046D7CF29D90830A9A72F36271CCE3A9D9C995FB4FF78DE1F1BBE49DD3A67590C6FF868C2FE098A72F3098D0BB980730D55998769168431238C11610C9899BE01B3A32C230C6D9054768737CC5A6987697B72C67EE2B5E6F9A1A6C72A0DCE2A99458256BA57FF2FB339C0A02CDBF5185A0B5D083252C3A42029FC023EF6A7F96C7D0404B8867FFE5D34CE2E569822C37271E831DDE8FC580DB351AE36CD0F8A0E64CF1E581C2959E732A84A38838DB76126FE94FD357388224BD7CECD29ADAEA40F3A9B8DD53033F2CA8FE3369A4DC88BAB9FD891CA4FA0E9726673906584D995766A2B5910E4C68ECADE21819276B57313D899C168B2BCF5F1B620747E3ADB03B0A2F905E567A9123C0A967EA6E817DA0FEEF6017A52C243C6C5CB35429379D0E6CCCE5FBC2CBA447CC23CE9CE711C25E8958857A4F79EF433FBEA24729595B64F2732B952A34D3CC4DFC99CAF715E1B7998A3D7250BC3E6D1E3A3C7DBB12B36271DDEF243C6D99F7FE4E7674EC54ACB2E3CF6EDE1ACA4E0D86DE1D4273AEE0CBFE1186594C6EE4CB7151DA0FC82DD99AE3715CB6F9D3B73FFC4DC2FED1CF1E0FF0FBF0B1FE0DCB2A0670000000049454E44AE426082);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (4,1,'Cloud_(64)',0x[encoded data, 4156 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (5,1,'Cloud_(96)',0x[encoded data, 6960 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (6,1,'Crypto-router_(128)',0x[encoded data, 26746 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (7,1,'Crypto-router_(24)',0x89504E470D0A1A0A0000000D494844520000001800000017080600000011218F2D0000000473424954080808087C086488000000097048597300000298000002980136D347DF0000001974455874536F667477617265007777772E696E6B73636170652E6F72679BEE3C1A0000047A4944415448C79D555D4C1C55143E77FE76F67F4110851A15D66D29155B6C09028235D1041FFCA1151AA535A68D3F2F3ED0DA072A2249638CE1AD10131F488DD4DAF6A5BE6852B14DA891861A3492942A942DCB82DDCE02BBB0ECFCCF78EE024D2196526E7232BB33F77CDF39E73BE75E62DB36AC77353434B0C5C5C54F949696BE9C48246E0E0E0E5EEEEAEA4AADE5C3AD17BCBDBD9D292A2A7AB2A6A6E6179EE7ED6030986759D6C7F8A9732D3F06D6BFB88282828FFAFBFBA71B1B1B770D0C0C9C22841C5EBDE9F31327376F88606A6ACA8EC7E38F4D4C4CCCB85C2E6D7878F8723299CC5ABD2F37DBF7CD8608A2D168706C6C2CA4AA6A7E7D7DFD8F82207C886489969696A32B005966631A20A0C3EBF56E451D805A616121E0FF74474747F0EE7DEC2A82756780DD666A9A06D4308BCC13173F393929AC00241B24307051E065F025020E5FB32B32601E9000C5AD1AB911EE6A3E72F47DA7D379079C9A699A045BD58DDDE5C28E228B1AB0F7D700A37C0AAD4951B526C3B20BE930E6E4E6C0C1F73EB06F4BD2C878387CFDB72B57629BF2F3DDB22CF7B32C1B40379D1AC7927B123C84B60FAD09F12A2C1C70C334E0FA8D71884971C8F27921E0F3108FC7132A0A85428AACA8A985859F5E797D8F74FEECCFF3D851060521AB342034BA93A7CF34BFBDB7FE539C503FA60CB3C93918BA3602A39128D0786CB04051B0E6F8CDE771811FCDB4CC8C1E0A3545956445FB5E53D2DF86B63E7DA2BEEEC58A1504CDC7DACFBB9DCEF28AF29D092147289E8848A81E0BA24380B4AC403AAD824D4C30751B6B8F80587F0EDB9112091C8B04CA3211761BC889E4DC71FC7DAAB3E3F87886E0C8279F5DF07ABC2F71820857B7FC6AF1052A04610B13FABB9C760F8D0234C30419C9545DC7773AD0125ABA0604BBC6E712C1324D24513224948C412F1CBAFD4C6565A5331E9BF2733C072E9187CDC9528609E731D3D235ABA2AC13A34C010A8D911B40CF5D8EE3709858602C1C029E8780D795C98696D6C67D0612D159109D2241411C2C15E78DD75EED7E34EF9119BF3F50F5B87B9383631C1020D3448D611E453FD8C3A24A40C9C1B2F1A063061428DBEF869C806F71467403A396419A9E415D6856149B50FDCE90E5FB80F6716D6DAD7B57C5735F3FB3A3EC4D973FCD19E6048A29C169F7BF7668B2C47A78BE80F5B9DD909BE5BB2330D5287C3302B762B78156C1210819437C4557B572B2FAC2A144070E1CDAF66C79D977DBB7EFD8268A0CCCF229F06A59908C4B326AC063C9385AEBB1F108FCF9D710E8A893B004CCF3AC959A9DBD284D45DEEAEBEB93C8BD6E34E4618EB5B6BE5B5555DD81875B40144570A2318458BD972EAADD3DE7B8545AE605C722B0039F862247E5F99943977A7B2FD84BC0DC1A879B8524DD7575753D7BF6367C555B5BB3DFEFF37248C46467E7B0B7E2713E530AACB76D1AE9D44CAC2B168DB48E8E8E6AF65D5173F73941E94615890EB6B5B57DF1C2EEDDA79FAFAE2EA3DF741416B331414FF7CF2567DF191A1A0ADBFF538E75DD074B8EFF20D1CE9E9E9E7D16902F594B67C842FAF0D53F7E3F4BB35DCBF9818CCA434FE5929212CFF249B096FD07E7378AC36FF5B9D50000000049454E44AE426082);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (8,1,'Crypto-router_(48)',0x[encoded data, 6520 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (9,1,'Crypto-router_(64)',0x[encoded data, 10080 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (10,1,'Crypto-router_(96)',0x[encoded data, 17858 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (11,1,'Crypto-router_symbol_(128)',0x[encoded data, 19776 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (12,1,'Crypto-router_symbol_(24)',0x89504E470D0A1A0A0000000D4948445200000018000000180806000000E0773DF80000000473424954080808087C086488000000097048597300000298000002980136D347DF0000001974455874536F667477617265007777772E696E6B73636170652E6F72679BEE3C1A0000047F4944415448C7AD556D685B55187E6F723FD27C775993B426B529A5741397ADB5B128EBA0E80FD14145E9FC338B5445A6A05044D03F326C0545860CBF50A65018B6F8B16E9DD4E8D6B1424D8A0C2DDA8E655BD2765D933669BED39B9B9B7B7DCF6D5AD2D221B6BEE1C939F7DC93F739E7793F42C9B20C6546F5F4F4E8BBBBBBDF37994CEDA22846A7A7A7BFBE70E1C2E0D0D090003B3055F943575717D3D1D1F1763C1E7FDEEFF7DF5A5C5C6C42A2CFDC6E771BECD03611D8ED760A4F7D7C0CADBFBFFF84CFE77B359BCD6A0C06C3F1FF85201C0EAB229188399148843D1ECF525F5FDFF0D2D252A25028D8774A4095C7A0B3B3F33D8AA25E94242949D3749C65D98C4EA76BD0EBF569A7D379ACB7B777FABF12D0E50F1A8DA6D1E572D91C0E870D1DC23A868787FD8140C0895BA6772551110DE580ADC86432443E6ED731B817812008722C1663774D90CFE7A96D9C03C683BCDEF90DA835D32081712B01A6ED3A01BBE32C22DE71EEC400BF69B1585AAD562B5D5757271B2A2DA682285B42F3B36268EECEFC6A3E8F17120C02CF27711ECBF37C8C5251B3986D57CC34F83011F2F74C53E4A8C0614FFBE34FB6B47ADA4E565559F6DF0ECE31C1B910A023942AAFC8251404E5662CCB41DDFDB5D0585F0F5AAD0EBE1B3EB7CA30B49763B97727C7BC7F6C5B076FBCD3F78920F0AF3034A372D53AA0A9B101F43A2D0467E720164FC0C8E8A82259B5D5062FBFD00DED8F7A60391A832FCE0CC0E5F17150ABD5282723B334FDF9C8D0C0894D04274F7D7AB49017CF17CA4EA9D36AE1D083FBC16C3400A7E1E0F2D50958595981AEA78F2AEF47BC976061310CB22C01851F955AB546A2A671A49F3B73FA83C10D82975E7FEB4AD3BE078E8824B8784A328A45118A38B755ED85473CCDC0B12C9C1FFD15388E83B6870E2A92A5D239F8EDF76BC0A38C2AD51A01198381EB57BF3FFBCD918D4AFEF9979FE2CDCDAD401B194506E278AFC50C4F3D76589129347F17C6C6FDA0A25910448948019566133CDCE2403237CC048210B81582643A43EA0906C6BCD18D5681016674B61AFAD4C71FC2B3CF1C83E6432D204932B8F7D54368210C89441A62892448941AEC363B905BFF1D98550E36F9E775A8B15AA0C66E855496071922E0BD780EB2E994A810A073520B2E59145DA954120607CF82CF3701EE030721B61205A7A31668860196D34175B5162422294211B6348AF8158E65C06ABB0F6ECCCC28598787E0886F72031DC22D1545FDBA5CD1E832F8FC1330F5D714603705A3C1082693198C462318F418704EA3C44153A1016D854ED9B3AEFDBA2101A90996AC14119942267D9BAC6F578D45A948DA08E47239C86433C0E7792501B6FCDD963B273DED4BF25342C023A68A62E187447861BC20F059D885A5D3C985E0CD1BAF61A24C12F568649350AB083E7C9BCF66AECD07660EF3B69A272C365B03C3B255A8E0BFF6A05C2E9BBD33179A892E472E9DFEA8FFAB542A75971C1C7DCB9B2A9964130E2684015189A8B53B6A0F98CC7BEC06A3A9126130198DAC4AAD4EA11051A9282DA2F39BDE911F7DB817D760B5E458DCB6556C6A526BD9A52975517509AA529C48DCC4120A044489EDFCFC03B71E6B6242A160270000000049454E44AE426082);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (13,1,'Crypto-router_symbol_(48)',0x[encoded data, 5940 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (14,1,'Crypto-router_symbol_(64)',0x[encoded data, 8428 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (15,1,'Crypto-router_symbol_(96)',0x[encoded data, 13908 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (16,1,'Disk_array_2D_(128)',0x[encoded data, 8948 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (17,1,'Disk_array_2D_(24)',0x89504E470D0A1A0A0000000D49484452000000180000000408060000009463FF180000000473424954080808087C086488000000097048597300000298000002980136D347DF0000001974455874536F667477617265007777772E696E6B73636170652E6F72679BEE3C1A0000011849444154189505C14B4FDB401480D1EFCE339080ECAAF481229058B1E137645F7E7DBAAD5A09894A6451CB5128D89E3B733947B6DBEDE9C7E3E3A6D54F5C7D110ECFCF7C3B9DF81513B7370F6C36CA300CAC9F9EF803749F7B40501CF3E1C0F93411EEEF79FDFB9B8BEB3B8661E0EBCB0B3F4550D529EC76BBACADE17DA556C187C8FB6A8534509D29C51011EA7A8D2F05039A092146F4EC0CF51E514562469C23E58C5E5E12A699E3F1E85DD775D00C284CD34C356354C5309C87FF6F6F2CA5F0AF56CC794AA9346BD4AA1484D7DA00A8E6D0A2B4D6185B238440DFF7E2F6FBFD29AFB245BF62B33EC75B631B02294652CCF45D474E99EFCD9052C8399153C439472C0B7DABA4942C8891520433AE9685B2CC8CE3583F0013BA8E908485C7E60000000049454E44AE426082);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (18,1,'Disk_array_2D_(48)',0x89504E470D0A1A0A0000000D49484452000000300000000908060000007477AFE20000000473424954080808087C0864880000000970485973000005310000053101B7ED28520000001974455874536F667477617265007777772E696E6B73636170652E6F72679BEE3C1A000004AC49444154384F4554DB6E1357145DE7CCC51ECF8CAF1927B11D038E13C425F4A14A0952C8A51212156F7DE4B552FB1D3CF01FFD15FA042FA8524B0554248D703071EC90D8F175C6335DE7D0C258A3339E59FBB6F6DA5BA4D3E93600EFFEDEBEBBBFB72B5AEF0730641FA66561369D613A9D603A1E438EC618C473483B853841B2BBB32D9E3F7F8D60C184340CCC660A3BC56C34829C4C711ECE202D1BC55209DDD6014C378F62A188F97C8E19BF4D89894643885988B32844DA7192E66A531CBC7A09BF5C43369BC53C9A633AA34FFA9D0F4788A3087DDEB3689EFCFDE6F5A85C0E86F2EAD5AB6EBD5EF77CCF132926DD7AFF11FBFBFBB8B3B181B5B5265656561098267EFDE121526767104890B24D61F1DD71AB8B9D9D1D6CDCBE8DE6EA2A6AD52A9AB68D27DF6D2226369D4AC17733B8DEB8829889AFAFAFA1525966210564320E361D07BF30C669A703DBB245D6F7505F0AB4DD6AA381A5A54514F27990643CC8FA78BC52C3E969076E2623F6F676DDADAD2D5F3C7AF4A83F994C7CC7F592DDFBDBE2F0B08B38561D30BFB2CA0E64423245D624034BC3C4F7FB7B78F6EC25164A364B82C6AA8E85C43AC49EB273969341295840FBE8002937AB598DC8E0F43F6C3219C3E4F3096F3F97C31A4978F3C7EF282C56E0B0B8907E14764AAC18B3B324A1CBFF76DAC1D1E101AAD5EAC0ACD56AA2DFEF633C0D6190D53831353B524A2049F41DB3881C1DF6E9D06097D43B2904933190225BFAE2BB44E199B8EFA4B52C0CD3804D9F699EAA488BB68276B1F2C96404637864B743BF266568126B89B90EABB0EA8AE358630D7E4F117F46020C436A3F2A4749A054EC59962912823F1C7FC4F6F6366EDDBA8566B3A9AAC4029D3DD9DC84797E4E5D46BA034ACB9D931EEEDDBB879B376F6295EC552B153458D0CFEBEB087BBDCF49D1B651AF68BCC22C2F2F6B596432197C43EC8FB4E9112B85D4645417039E36AE5DBB46092D214FACEAC67DD7C5C320C019A5A9FC2A5905416088A74F9FF6DFBE7DEB77CF2F928D1B3744A7D3E790F56153CBAADD21872C224349AC062A84244B2AA98D8DDBF8EBD53B262235131A4BDC9CB7626CC2AE49D342B15840A77D8C94E3E9A06C95C6451CD088C3ACB1FCEF643C2C96031C1FBD839F2F2145ACFAA6B021B173621579E13CD6F13B271F71F7EEDD89541A570CB869475CB9526790A26652B1E4B16A9743684B811B9E87541273809CCF434686A230C32DB4801CB5ADB00E83DA4C719DCF2675E0D1B6902F209B52F23090CB6575118A1C499F0E136C3099313797654ACE53913142FD9D83AA3BA264A5164796D8153E8FB8B9D40269B55A78F1E245284F4E4ED06EB7A947E8816DB53E684934B805F40662DB8A0CF298ED372E2E34238C8DE170886EB7F705ABA4562E97B1C2E00F78CE3E7DFA3C13C4D62A4BDAAE42621658B0EFFB5A16D789DDE2F305FD0AFE54B28B41499F0A5B2C16BF60EF10FB2D89B9BCBCD43E554C622C831AFB89129A546AF574A15414B66924FF1C1D627039C439875B253AA1447E3BFB8428E3EAC14B848C4BDCEF713C4B7ABD0E2E06035CF407B8E4AEBE64F0973C25B131D4A09949EBB80D2F974F144153258930A26D822E89F993B2743D1FA66D27A661A1DDE9C2F1FEDF56941A25A316C007CEDD1BDA7AC47208E3EE6987AEC2C9BF78BC39D24D63522D0000000049454E44AE426082);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (19,1,'Disk_array_2D_(64)',0x89504E470D0A1A0A0000000D49484452000000400000000C0806000000D2F3BBC90000000473424954080808087C0864880000000970485973000006EC000006EC011E7538350000001974455874536F667477617265007777772E696E6B73636170652E6F72679BEE3C1A000007504944415448895D564B6C1BD7153DC37943724851143592F5A1E4C88E637D6CB96EE5204BC3710BD8591428BAE82248760D90753701BACABA5DB45D6613A4408174EF14698BB6A88BDA559554AD23D3526D49D4CF11298922298ADFF9F4DC478E237788C7F799FB7BF7DD73DE28DBB6D73B9D4E3A91EC2BDF7AF3D6C5D9E959A4D313F8EFD37F6160208D442201BED7ADDD6EBF3C66737D1FC7952AAECF5F312EBD7A29B8FFB7C748A53A181B1D85EB795ACE75455EF4BAFACD6653CF3DCF47DC8E231E8BA1B4FB0CF1C13138CE10629C6B1F6CAE34D7EDCE5B2D7438F6683730CC606EE6B5C8D2E26270617410BE3D8073E7CEF13DFDB4BB318ADF4EC7D56BE2B31B7707B9C7B9A3A8651AFDFDFD3595C964D2A6693A1DCF3B4DF7A70DC7C9E0F0B081C07731911D478B4E1B0D70EEC135008FC6DEA856104422F86DB188E1E16124B989FE548AC9B28D95AFD6F1DE7B77B543695484EFB95A3F43F9EF5DB880DF3D7982C56A15737373F099C0C9C94918C7DB689926EDF4699FE2A7D3EADA6830803BF4D70A027CBC95C7C8C808127D29633093C1D4F909E330FF040BB7BF857ABD0E5F92D56E691DB1933D39C1DD9919FCFAE1437CC5B5D9D9598C67B3D6F56B57D3E57259A9F1F171300128F314E589D011FDC0300C249349DD075C9026C1CA894629E3F7D6CF3E9665E95EF4C48E3CA19E9C9AE29A4D198373E385BEA1C772B2A2138FC7F5BAC8BBBD3579AF7DF6E29077B2268FD896271A8D6AF9504F29A5633529273E23BD58453F168D1A520DE24B8DB254250152CA7566E8E0E88819CEA2500890CBE560D17058F69E6497ED2F5494521A1C74F4BCC57195996E349AB8FEED57F08FC57FF25DA65BBA0C4297B2EBA1924EE3A3FD021A03037068A3745C260412D8C8E7516A1AE867F0CF9F3FD7C1777ABE24419615C5671A4E84D6D83898060D9FC3C343E477F6707E6C0AABAB6B4813B21EFD48D94BB24C65619B95F98BF5753459A923D4AFD51B28140B5EBBD520D4D3AE927292E7A8548645C74962DE34D994A9D74DC97CC464F3C0BCBF386DD38C40598A29E558B9B0B9A1583C469C2A24EC36224644373929B1C173D1B2F2A74C0597BEA23C19A55815C4BC850EA1E27D534EDC40D75BA05B1048D54037598A702027482558017986EF65CDED5549E007DA86AE40B12515C79F19315EC425D5A51CC7C1D6D616B3AC741909216D6C7CAD9517161634AE4E4F4F35A6645CABD5F046A1008F063E26A62581A227E5DFA44C2EB78E0F3E785BE34FE4C32636129B9BF821F1F89B2FBEC003CE673896CACC66B3F08A9B68D0CE057284C887FE640362EB478CAB4E1FBFDCDED63E2DCB445F5F1FE66667B0B7BA8C5B3F7853FBF846D760F37089F3775F7F1D3FFBFC732C934FA6E9F32C34558A25221090D44A7665EC384994CBAE4E8C380F5B484845C118E5248B52E6660F8F4288F248194B20221FEA494FA2C53392DF690FBB41976C34BCCA4CAC1577B0BFBFAFB17BD6A7B41DC1774FC7D395D2E598020F23ECC5E7FFC75BA6ED15DAAC5347F385AE081F57AE5C1108C4949C9C10E1F6EE1E8ECB153C26EED36907CD561B1B3C31C1A3EB0A89750390327D10513A881431DDA25C87763799AC269D5EBB368A7F3F7AC4D349D1A1A73129B2A25B27BC3E2D14E1F1E49C988DFDE2016CAE952BAB68987DB089DD1263D09091600D81591409FA7B20B750E0223B799EE5CD78B88967EB1B38A5FFC1B157B1B5BDA32BC2D757A4E85988B33F8AC6F0E9C101BCF12C26780D0B07484C21612AC97658E21992D35566C6B6B338A99634C68CDE09753ABDDE2723B79BB0186485998F276C8DBB577895DDB871036BAB7FE07DDC210FC4BB777144EE700A324B1E7D2584DCA8DBE6353B3C34A40315DED95AD9E5C60710ED718F4F920B7402BBDF0111C667D1CFA904CD4351E4A0F3931378BA9A839D8CC08D0D13DBD0890978586E8FB85D564194FA4DEAD67840C3FA5BC1C5E2E222F809D0562764EF52A9A4B12D952CCEBEFC724597DACD9B377572CE36917F8BB22D6EE2E76B6B18E22648299A50B689CFA74FD7F1CE3B3F469858B11BEAF6B1A27E72FB363EBC770F7FAD54203750089D66268D3A713E3F3FFF423EE40EF1F93E658FB9F90FC91F222F5522DCB3F09DEB78B6FC1077BFFBFD97E20C752FD2FE4FEFDCC1FB9F7C8225CEA5DAC91FC6D4D494BE45D401CB43F053AD54F495234667672F3209EB3A4BB291B085D8FA235B8A272749D2A7A3A27A23D3D3D3FCFF0CCBCBCBDA79F8C5283AD2C789FF8F9696348784DF16C2DC12EC5EF11089D17E7DF5865F9CA19EF4F7A81BED71C7D9EF80FF3C5A4192BDE875BF30DB2FB50ED77E75FF3E8A1C77757DCC5F9D577DC9842432AAF2F9FCFEEEEE6E9510A8546AA7632BB9356368E89CA1EC44705CAD692782474F48C724DBC723D88CC635BE078747B4D17AABE5ED7DBDAF7EFFA73FE3D6EDB9606FBFA81329EF7CB9CC9820C5ABB44D3CFF5DEE686718E399411C954F8238AFCE93FCB6111BB948DB36F1AB60C548B02A46351BB6DFE58F1DE919FC6BA97ECE3D345DDFCBEFECAA54C681337439A8910BE2E495087D58B60F9BBCE5F77496D8C72E5DC665DAE9101EF9CDCD13729A47C2AFFF0F76E33820C635A0230000000049454E44AE426082);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (20,1,'Disk_array_2D_(96)',0x[encoded data, 6448 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (21,1,'Disk_array_3D_(128)',0x[encoded data, 9514 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (22,1,'Disk_array_3D_(24)',0x89504E470D0A1A0A0000000D4948445200000018000000060806000000D9AB5E130000000473424954080808087C086488000000097048597300000298000002980136D347DF0000001974455874536F667477617265007777772E696E6B73636170652E6F72679BEE3C1A0000018E49444154289185904F8A135118C47FDFFBD7AF9BF993C45132C8B81AD45518F00CA22E0457D979214FE201240B5D78830105575E4026A3E2A4EDA4DFEBEFB50B276EAD4D4155511425E338B2C772B99C596B9F02CF4B29CF44E474EFFF87BF96523E88C8FBDD6EF771B55ADDEC3B25C6F8E6C5CB57AFEB78745C551253CE92FA1D590BD3A313C42A43CEF4BB1D2967BC01EB1CC607D2AD56D70DDAB7D48753F2308C7DB7DDB65D7BF3E5F3A7B7F6E2E2E2DDE3470F8F839BFA935994EEE777CE53CFA6AA38BB7FCE6C12299A395D5FD109CC4E2654DEFF9D77BDE66EEA397C7046D95C7330B943D76EE46C7DE5AF8483F97CFEC42C160B5155C01242205615C55A4A51721EF0DE1342C055150561181401BCF7D81028C6A0AA08E3BFAC840A80B66D314DD38CC330607DE277D7313ACF3711C4188C516E362D2965D6CE63EA48DF6772B9FDBF69F8E51C591595C0A08A738E1F7524C40820E6F2F2B2F52130AA10BCA7E4CC3D6B1104303475C458C3B42863DF136385B3165585ED960320788FB302E3484A89E394D03CA0A5E81FC739C561226564990000000049454E44AE426082);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (23,1,'Disk_array_3D_(48)',0x89504E470D0A1A0A0000000D49484452000000300000000C080600000024BA3E510000000473424954080808087C0864880000000970485973000005310000053101B7ED28520000001974455874536F667477617265007777772E696E6B73636170652E6F72679BEE3C1A0000053E494441544889AD554B6F135714FEE6E199B13DB6E347E247E224240DE1212A955208AFB41554455D7483CAB28BAECA4FA01B547E032BFE45B7A08A765321A42054A9905425C1896DECE03876E2C41E8F67A6DFBD0EA88B2051B5231DCDBD77CE39F79CEF7CE78C120401DEE7B97EFD7ADE75DD2FB9BC46F982927AF3ED9F3E0EF3F73EDF29CF154579C0F77DC7717E7DF8F061E77DE252DE95C08D1B378C582C76914EAF514704FDE16101FC1FC11FB27679EF6FDC3FE0FAFEDCDCDCD2EDDBB7FD4313A06807890C6EDDBA35E3FBFE351134CF3EE799FDAECBFEEDFE3F26D7A4FC2C12627CF7EFDEBD5B7A9B80699AAB83C12073FED265FBB3C545A5B1E54055F6605926FA4E1F4EBF8F3E85F4916B3A80E70738F7C9193C7BBE81E4888E9011A2AE43BDA18ED4EDF5A8E723164FA0555F8761A7904AA524620EF55CA947FFB4133650554C158BA8BC58463495A36E52DEE5B8435D1183B843F86EEDEEFA7F2D3FEF66B3D9BA5A2C1633535353B15432A9244712A8961BB87CE922E68F1EC5D4D42472D93124BC017E9C3F8A50ED15745541D8322074374A0D2C9C3B8BB9D9594CF2F2B1D10C8A0317DFE7B270AA15D8913032C9044ECC4EC3E7F911FA4B33303B6241D7147CD0DDC7B7DC57CB1BB042218CA653288E266184344C8C17E41D11D3808A00E719C3D77614D54A19A94442BD72E54AF4C2850B797D6666466617305BCBB2303D9DC3A3478F64F9243A0259CABDE565F4A35184348DC804B06D1BC5621A4F9E3C19227EA0EB537EAA54A08F8C8095854B79F9B20C239AC0DADADA5B3D217BB47B5DABC18EC5E8D39367E5D74D247351944A25B9EFB192E2FD9862753AF25E6FE061696909131313039DE8636F6F0FEDCE1E3A7CF75D1FA6A950CC0392B1E80CB8D5EB42B7C2A400F7818F9D9D5D0C3C452663327145E8515C02D1E1651AED05837DCF87467A884727CA2AD72A4150F81614D9F73C4423119AAAF4E741A30F917888BAE24CEAAB1A443BF458C5307541FBE13985816A024193A5D2F9A152AEE3D3C5459C387E1CA23A857C1E498672EFEA55E8CD2D782CA52E1D2878556DE012E976FCD831566E1AF95C0ED3FCF6C3E9D3E86F6E42D77526676276322FAB344B7F6363A4643C0E8B099EA0EECDF979D4580591A448A4400A093B01EC2829C94908833D76351EC337A4E966BD0E43577966F0FBA8A6DCB97367777575D56E34B771F6CCC728AD37885517268D860DECA2CF32EA7D071D22A412194D0B6161E12C1E3FFE03A9A42993719C61A30DA8AB12A936AB106265D2990C6AA5355228CE868E497407EEE0806E3D285C3769176752939345ACAE3C4322934584C988E615FA4237A0DF80D469D3778454DE20C5161616BA3ACB186C6F6FB364869C12B55A9FC6862CAFA485F8C9F41514C9BD173B3BA49125A9C1A6273D4C7232CAAA78073F231FAA03E478C13E2F8F84C344358AA8A5C3D75489BA4BA445BF69DC1BF49F61A337D8CC21A26ED3CE543C39A90C41A183512AA812A66E982CD966D282017556E2E9D3A79E2ACA57AD56258A02C1F5F50A4E9D3A85594E1636892C799206DF712A294C5450417052A0B2B9B98593274F4AAABDD11DE7C55F65B3E8351A1200E1B758C849BBF1F171A4D369490B31308EF0FBE704ADD56AB12714C9FBFC685A52A850284840A3222926FE11C1389748A0DD6ECBFB678674D4B4442271736565C51DCB4F589CAB30CC10A7C60BECB2E3B7E95834769783EC97661303A2291A352036598ED781EF62AB51439B0DDDDA69A3B3BF8F1D36DE126D14EA7A444F6330D55A1D513B8E9EE3CAB9DE276D02367F9355FF9DD41053480B9912F5579C4291585CEA88FF85686CF19419F49FDCDB764C542468345EF70878F76F6265D90C03A2C2520000000049454E44AE426082);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (24,1,'Disk_array_3D_(64)',0x[encoded data, 4272 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (25,1,'Disk_array_3D_(96)',0x[encoded data, 6986 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (26,1,'Firewall_(128)',0x[encoded data, 27456 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (27,1,'Firewall_(24)',0x89504E470D0A1A0A0000000D494844520000001800000012080600000041EC1E9E0000000473424954080808087C086488000000097048597300000298000002980136D347DF0000001974455874536F667477617265007777772E696E6B73636170652E6F72679BEE3C1A00000369494441543811B5C1CDAB94551CC0F1EFEF3CE7799999FBDA1DC597C29B24227951304245A556AE24E88D68E92AE81F701141DBA27D6DAA55B86FD5227011AEB216891712830A3135EFCBCC9D79E679CEF99D5F230A4584D3A6CF47CC8C59E2C5E5335ED28D2B3F0F066BFB57BA2B85EDE7B307EBFC0762663C14DF5D7A495BFBAD5CCC4A3EDE5C1FBFD9DF6B8BED913CC8D15873DE89DC4BBD7845DAECB4DDB65738942E753F197ECE0C626620E286AF2E7C23257792973E6A1FC5717A3FFE2EC7D3D88ADE9A1FC7A195D9B3E927396823FD3A3F35BC15AC3A2E67775D1E5CE5093C1F88BBFD5AF7C3AAC7411BBA17A3262FBBB4DB3D2DABEDE56C6E63AB25DE4E45679F30F1FA7CB53BFAF284A7EB0B993C3DF6CCE07FBD5E9DDABA69EFEC3969B43BA95B1D4EEC347A3A7BCEA477CE93AF97C4730D320FB23BF8A602DBD7A22722CEA5C80C7EABE5AD5DAF4B4F1723F94222F4C09749C624ACDF924E3AD8C8E1C7A2E9DEC927BA3D977DBABD31F865A3F5078ED4E1D2059EC8CF5D4877C358C8EEBBE06EECDE29EE556DB659783FCABA6EA7E9C4B939DAB224AA96613229AD69B87FD76E8D5B3BF6FDB75233835FF9626D15E960DEE72EA5658D11CD329A22213D4F52256D6E1245B0188955852B0AE7CD70297966F029EB252D0AD40C0B8164468A110512606549AC2A34256C32416344550921904288CCE02731EA1496129A122642604A048D11055208688C685DA3CEA1AAE6BDC7A79431836FDA36A973281052C29C23C588360D3A1E93BA5DD47B529EA3DE837364A391A4D18818823283AFF33C8F55858D4644E74866A808A92C094C753A2810DB963818A0AAB4759DCC8CE07D2E221E3020316553FC8D1F8D462D53D13934040C083162DE13016B5B625D23DEC3FC3C4E843CA5AE1F8D7850D70BC0121081044411098002F6901F7A7F356D6F1F7355B566228B1148790EAAA82AA24A363F0F22C4CD4D4C957A674723D03AB7082CF3880101A8811A684424FA97AF5DFB52442E03C57B2B2BC7F6989D595A5E3EDB71EE68D63407AA7EDF5B96A1DBDB4855E1AB8AA269F2D0348C542B601130C000052AC001AD992531331E9229FE92019DC3B072BE28CE3C531427F7F6FB2F74B2EC501EE3535F0D06B72631AE7E371EBFBDAE7A03D80686400D04334B3C2666C6BF91291E112007BAC0C21B4B4BAB716BAB7B137EB80E7F00CA6336C53F8899F17FFA13E957F4FFE373D1E20000000049454E44AE426082);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (28,1,'Firewall_(48)',0x[encoded data, 6022 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (29,1,'Firewall_(64)',0x[encoded data, 9636 characters]);
INSERT INTO `images` (`imageid`,`imagetype`,`name`,`image`) VALUES (30,1,'Firewall_(96)',0x[encoded data, 18280 characters]);
