--- /dev/fd/5 2024-02-20 07:15:17.913182847 +0000 +++ - 2024-02-20 07:15:17.914359982 +0000 @@ -23,13 +23,10 @@ `attempt_clock` integer DEFAULT 0 NOT NULL, `rows_per_page` integer DEFAULT 50 NOT NULL, `timezone` varchar(50) DEFAULT 'default' NOT NULL, - `roleid` bigint unsigned DEFAULT NULL NULL, - `userdirectoryid` bigint unsigned DEFAULT NULL NULL, - `ts_provisioned` integer DEFAULT '0' NOT NULL, + `roleid` bigint unsigned NOT NULL, PRIMARY KEY (userid) ) ENGINE=InnoDB; CREATE UNIQUE INDEX `users_1` ON `users` (`username`); -CREATE INDEX `users_2` ON `users` (`userdirectoryid`); CREATE INDEX `users_3` ON `users` (`roleid`); CREATE TABLE `maintenances` ( `maintenanceid` bigint unsigned NOT NULL, @@ -48,6 +45,7 @@ `proxy_hostid` bigint unsigned NULL, `host` varchar(128) DEFAULT '' NOT NULL, `status` 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, @@ -72,8 +70,6 @@ `custom_interfaces` integer DEFAULT '0' NOT NULL, `uuid` varchar(32) DEFAULT '' NOT NULL, `name_upper` varchar(128) DEFAULT '' NOT NULL, - `vendor_name` varchar(64) DEFAULT '' NOT NULL, - `vendor_version` varchar(32) DEFAULT '' NOT NULL, PRIMARY KEY (hostid) ) ENGINE=InnoDB; CREATE INDEX `hosts_1` ON `hosts` (`host`); @@ -86,12 +82,12 @@ 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, `uuid` varchar(32) DEFAULT '' NOT NULL, - `type` integer DEFAULT '0' NOT NULL, PRIMARY KEY (groupid) ) ENGINE=InnoDB; -CREATE UNIQUE INDEX `hstgrp_1` ON `hstgrp` (`type`,`name`); +CREATE INDEX `hstgrp_1` ON `hstgrp` (`name`); CREATE TABLE `group_prototype` ( `group_prototypeid` bigint unsigned NOT NULL, `hostid` bigint unsigned NOT NULL, @@ -118,6 +114,7 @@ `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; @@ -146,6 +143,7 @@ CREATE TABLE `httptest` ( `httptestid` bigint unsigned NOT NULL, `name` varchar(64) DEFAULT '' NOT 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, @@ -302,12 +300,13 @@ `gsm_modem` varchar(255) DEFAULT '' NOT NULL, `username` varchar(255) DEFAULT '' NOT NULL, `passwd` varchar(255) DEFAULT '' NOT NULL, - `status` integer DEFAULT '1' 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, @@ -319,7 +318,6 @@ `event_menu_url` varchar(2048) DEFAULT '' NOT NULL, `event_menu_name` varchar(255) DEFAULT '' NOT NULL, `description` text NOT NULL, - `provider` integer DEFAULT '0' NOT NULL, PRIMARY KEY (mediatypeid) ) ENGINE=InnoDB; CREATE UNIQUE INDEX `media_type_1` ON `media_type` (`name`); @@ -328,7 +326,6 @@ `mediatypeid` bigint unsigned NOT NULL, `name` varchar(255) DEFAULT '' NOT NULL, `value` varchar(2048) DEFAULT '' NOT NULL, - `sortorder` integer DEFAULT '0' NOT NULL, PRIMARY KEY (mediatype_paramid) ) ENGINE=InnoDB; CREATE INDEX `media_type_param_1` ON `media_type_param` (`mediatypeid`); @@ -348,11 +345,9 @@ `gui_access` integer DEFAULT '0' NOT NULL, `users_status` integer DEFAULT '0' NOT NULL, `debug_mode` integer DEFAULT '0' NOT NULL, - `userdirectoryid` bigint unsigned DEFAULT NULL NULL, PRIMARY KEY (usrgrpid) ) ENGINE=InnoDB; CREATE UNIQUE INDEX `usrgrp_1` ON `usrgrp` (`name`); -CREATE INDEX `usrgrp_2` ON `usrgrp` (`userdirectoryid`); CREATE TABLE `users_groups` ( `id` bigint unsigned NOT NULL, `usrgrpid` bigint unsigned NOT NULL, @@ -381,8 +376,6 @@ `publickey` varchar(64) DEFAULT '' NOT NULL, `privatekey` varchar(64) DEFAULT '' NOT NULL, `menu_path` varchar(255) DEFAULT '' NOT NULL, - `url` varchar(2048) DEFAULT '' NOT NULL, - `new_window` integer DEFAULT '1' NOT NULL, PRIMARY KEY (scriptid) ) ENGINE=InnoDB; CREATE INDEX `scripts_1` ON `scripts` (`usrgrpid`); @@ -406,7 +399,6 @@ `formula` varchar(1024) DEFAULT '' NOT NULL, `pause_suppressed` integer DEFAULT '1' NOT NULL, `notify_if_canceled` integer DEFAULT '1' NOT NULL, - `pause_symptoms` integer DEFAULT '1' NOT NULL, PRIMARY KEY (actionid) ) ENGINE=InnoDB; CREATE INDEX `actions_1` ON `actions` (`eventsource`,`status`); @@ -511,7 +503,13 @@ `alert_usrgrpid` bigint unsigned NULL, `default_theme` varchar(128) DEFAULT 'blue-theme' NOT NULL, `authentication_type` integer DEFAULT '0' NOT NULL, - `discovery_groupid` bigint unsigned 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, + `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, @@ -561,7 +559,7 @@ `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_auth_enabled` integer DEFAULT '0' NOT NULL, + `ldap_configured` integer DEFAULT '0' NOT NULL, `ldap_case_sensitive` integer DEFAULT '1' NOT NULL, `db_extension` varchar(32) DEFAULT '' NOT NULL, `autoreg_tls_accept` integer DEFAULT '1' NOT NULL, @@ -569,6 +567,19 @@ `compress_older` varchar(32) DEFAULT '7d' NOT NULL, `instanceid` varchar(32) DEFAULT '' NOT NULL, `saml_auth_enabled` integer DEFAULT '0' NOT NULL, + `saml_idp_entityid` varchar(1024) DEFAULT '' NOT NULL, + `saml_sso_url` varchar(2048) DEFAULT '' NOT NULL, + `saml_slo_url` varchar(2048) DEFAULT '' NOT NULL, + `saml_username_attribute` varchar(128) DEFAULT '' NOT NULL, + `saml_sp_entityid` varchar(1024) DEFAULT '' NOT NULL, + `saml_nameid_format` varchar(2048) DEFAULT '' NOT NULL, + `saml_sign_messages` integer DEFAULT '0' NOT NULL, + `saml_sign_assertions` integer DEFAULT '0' NOT NULL, + `saml_sign_authn_requests` integer DEFAULT '0' NOT NULL, + `saml_sign_logout_requests` integer DEFAULT '0' NOT NULL, + `saml_sign_logout_responses` integer DEFAULT '0' NOT NULL, + `saml_encrypt_nameid` integer DEFAULT '0' NOT NULL, + `saml_encrypt_assertions` integer DEFAULT '0' NOT NULL, `saml_case_sensitive` integer DEFAULT '0' NOT NULL, `default_lang` varchar(5) DEFAULT 'en_US' NOT NULL, `default_timezone` varchar(50) DEFAULT 'system' NOT NULL, @@ -602,24 +613,15 @@ `geomaps_tile_url` varchar(1024) DEFAULT '' NOT NULL, `geomaps_max_zoom` integer DEFAULT '0' NOT NULL, `geomaps_attribution` varchar(1024) DEFAULT '' NOT NULL, - `vault_provider` integer DEFAULT '0' NOT NULL, - `ldap_userdirectoryid` bigint unsigned DEFAULT NULL NULL, - `server_status` text NOT NULL, - `jit_provision_interval` varchar(32) DEFAULT '1h' NOT NULL, - `saml_jit_status` integer DEFAULT '0' NOT NULL, - `ldap_jit_status` integer DEFAULT '0' NOT NULL, - `disabled_usrgrpid` bigint unsigned DEFAULT NULL NULL, PRIMARY KEY (configid) ) ENGINE=InnoDB; CREATE INDEX `config_1` ON `config` (`alert_usrgrpid`); CREATE INDEX `config_2` ON `config` (`discovery_groupid`); -CREATE INDEX `config_3` ON `config` (`ldap_userdirectoryid`); -CREATE INDEX `config_4` ON `config` (`disabled_usrgrpid`); CREATE TABLE `triggers` ( `triggerid` bigint unsigned NOT NULL, `expression` varchar(2048) DEFAULT '' NOT NULL, - `description` varchar(255) DEFAULT '' NOT NULL, - `url` varchar(2048) DEFAULT '' NOT NULL, + `description` text 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, @@ -639,7 +641,6 @@ `discover` integer DEFAULT '0' NOT NULL, `event_name` varchar(2048) DEFAULT '' NOT NULL, `uuid` varchar(32) DEFAULT '' NOT NULL, - `url_name` varchar(64) DEFAULT '' NOT NULL, PRIMARY KEY (triggerid) ) ENGINE=InnoDB; CREATE INDEX `triggers_1` ON `triggers` (`status`); @@ -738,7 +739,6 @@ `value` varchar(2048) DEFAULT '' NOT NULL, `description` text NOT NULL, `type` integer DEFAULT '0' NOT NULL, - `automatic` integer DEFAULT '0' NOT NULL, PRIMARY KEY (hostmacroid) ) ENGINE=InnoDB; CREATE UNIQUE INDEX `hostmacro_1` ON `hostmacro` (`hostid`,`macro`); @@ -754,7 +754,6 @@ `hosttemplateid` bigint unsigned NOT NULL, `hostid` bigint unsigned NOT NULL, `templateid` bigint unsigned NOT NULL, - `link_type` integer DEFAULT '0' NOT NULL, PRIMARY KEY (hosttemplateid) ) ENGINE=InnoDB; CREATE UNIQUE INDEX `hosts_templates_1` ON `hosts_templates` (`hostid`,`templateid`); @@ -1127,12 +1126,6 @@ ) ENGINE=InnoDB; CREATE INDEX `events_1` ON `events` (`source`,`object`,`objectid`,`clock`); CREATE INDEX `events_2` ON `events` (`source`,`object`,`clock`); -CREATE TABLE `event_symptom` ( - `eventid` bigint unsigned NOT NULL, - `cause_eventid` bigint unsigned NOT NULL, - PRIMARY KEY (eventid) -) ENGINE=InnoDB; -CREATE INDEX `event_symptom_1` ON `event_symptom` (`cause_eventid`); CREATE TABLE `trends` ( `itemid` bigint unsigned NOT NULL, `clock` integer DEFAULT '0' NOT NULL, @@ -1160,8 +1153,6 @@ `action` integer DEFAULT '0' NOT NULL, `old_severity` integer DEFAULT '0' NOT NULL, `new_severity` integer DEFAULT '0' NOT NULL, - `suppress_until` integer DEFAULT '0' NOT NULL, - `taskid` bigint unsigned NULL, PRIMARY KEY (acknowledgeid) ) ENGINE=InnoDB; CREATE INDEX `acknowledges_1` ON `acknowledges` (`userid`); @@ -1201,7 +1192,7 @@ `listen_ip` varchar(39) DEFAULT '' NOT NULL, `listen_port` integer DEFAULT '0' NOT NULL, `listen_dns` varchar(255) DEFAULT '' NOT NULL, - `host_metadata` text NOT NULL, + `host_metadata` varchar(255) DEFAULT '' NOT NULL, `flags` integer DEFAULT '0' NOT NULL, `tls_accepted` integer DEFAULT '1' NOT NULL, PRIMARY KEY (autoreg_hostid) @@ -1215,7 +1206,7 @@ `listen_ip` varchar(39) DEFAULT '' NOT NULL, `listen_port` integer DEFAULT '0' NOT NULL, `listen_dns` varchar(255) DEFAULT '' NOT NULL, - `host_metadata` text NOT NULL, + `host_metadata` varchar(255) DEFAULT '' NOT NULL, `flags` integer DEFAULT '0' NOT NULL, `tls_accepted` integer DEFAULT '1' NOT NULL, PRIMARY KEY (id) @@ -1413,7 +1404,6 @@ `userid` bigint unsigned NOT NULL, `lastaccess` integer DEFAULT '0' NOT NULL, `status` integer DEFAULT '0' NOT NULL, - `secret` varchar(32) DEFAULT '' NOT NULL, PRIMARY KEY (sessionid) ) ENGINE=InnoDB; CREATE INDEX `sessions_1` ON `sessions` (`userid`,`status`,`lastaccess`); @@ -1478,13 +1468,11 @@ `name` varchar(2048) DEFAULT '' NOT NULL, `acknowledged` integer DEFAULT '0' NOT NULL, `severity` integer DEFAULT '0' NOT NULL, - `cause_eventid` bigint unsigned 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 INDEX `problem_4` ON `problem` (`cause_eventid`); CREATE TABLE `problem_tag` ( `problemtagid` bigint unsigned NOT NULL, `eventid` bigint unsigned NOT NULL, @@ -1617,7 +1605,7 @@ `taskid` bigint unsigned NOT NULL, `type` integer DEFAULT '0' NOT NULL, `data` text NOT NULL, - `parent_taskid` bigint unsigned NULL, + `parent_taskid` bigint unsigned NOT NULL, PRIMARY KEY (taskid) ) ENGINE=InnoDB; CREATE TABLE `task_result` ( @@ -1748,9 +1736,6 @@ `value_sysmapid` bigint unsigned NULL, `value_serviceid` bigint unsigned NULL, `value_slaid` bigint unsigned NULL, - `value_userid` bigint unsigned NULL, - `value_actionid` bigint unsigned NULL, - `value_mediatypeid` bigint unsigned NULL, PRIMARY KEY (widget_fieldid) ) ENGINE=InnoDB; CREATE INDEX `widget_field_1` ON `widget_field` (`widgetid`); @@ -1761,9 +1746,6 @@ CREATE INDEX `widget_field_6` ON `widget_field` (`value_sysmapid`); CREATE INDEX `widget_field_7` ON `widget_field` (`value_serviceid`); CREATE INDEX `widget_field_8` ON `widget_field` (`value_slaid`); -CREATE INDEX `widget_field_9` ON `widget_field` (`value_userid`); -CREATE INDEX `widget_field_10` ON `widget_field` (`value_actionid`); -CREATE INDEX `widget_field_11` ON `widget_field` (`value_mediatypeid`); CREATE TABLE `task_check_now` ( `taskid` bigint unsigned NOT NULL, `itemid` bigint unsigned NOT NULL, @@ -1774,13 +1756,11 @@ `eventid` bigint unsigned NOT NULL, `maintenanceid` bigint unsigned NULL, `suppress_until` integer DEFAULT '0' NOT NULL, - `userid` bigint unsigned 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 INDEX `event_suppress_4` ON `event_suppress` (`userid`); CREATE TABLE `maintenance_tag` ( `maintenancetagid` bigint unsigned NOT NULL, `maintenanceid` bigint unsigned NOT NULL, @@ -1803,7 +1783,6 @@ `hostid` bigint unsigned NOT NULL, `tag` varchar(255) DEFAULT '' NOT NULL, `value` varchar(255) DEFAULT '' NOT NULL, - `automatic` integer DEFAULT '0' NOT NULL, PRIMARY KEY (hosttagid) ) ENGINE=InnoDB; CREATE INDEX `host_tag_1` ON `host_tag` (`hostid`); @@ -1834,7 +1813,6 @@ `authprotocol` integer DEFAULT '0' NOT NULL, `privprotocol` integer DEFAULT '0' NOT NULL, `contextname` varchar(255) DEFAULT '' NOT NULL, - `max_repetitions` integer DEFAULT '10' NOT NULL, PRIMARY KEY (interfaceid) ) ENGINE=InnoDB; CREATE TABLE `lld_override` ( @@ -2125,173 +2103,14 @@ PRIMARY KEY (sla_service_tagid) ) ENGINE=InnoDB; CREATE INDEX `sla_service_tag_1` ON `sla_service_tag` (`slaid`); -CREATE TABLE `host_rtdata` ( - `hostid` bigint unsigned NOT NULL, - `active_available` integer DEFAULT '0' NOT NULL, - `lastaccess` integer DEFAULT '0' NOT NULL, - `version` integer DEFAULT '0' NOT NULL, - `compatibility` integer DEFAULT '0' NOT NULL, - PRIMARY KEY (hostid) -) ENGINE=InnoDB; -CREATE TABLE `userdirectory` ( - `userdirectoryid` bigint unsigned NOT NULL, - `name` varchar(128) DEFAULT '' NOT NULL, - `description` text NOT NULL, - `idp_type` integer DEFAULT '1' NOT NULL, - `provision_status` integer DEFAULT '0' NOT NULL, - PRIMARY KEY (userdirectoryid) -) ENGINE=InnoDB; -CREATE INDEX `userdirectory_1` ON `userdirectory` (`idp_type`); -CREATE TABLE `userdirectory_ldap` ( - `userdirectoryid` bigint unsigned NOT NULL, - `host` varchar(255) DEFAULT '' NOT NULL, - `port` integer DEFAULT '389' NOT NULL, - `base_dn` varchar(255) DEFAULT '' NOT NULL, - `search_attribute` varchar(128) DEFAULT '' NOT NULL, - `bind_dn` varchar(255) DEFAULT '' NOT NULL, - `bind_password` varchar(128) DEFAULT '' NOT NULL, - `start_tls` integer DEFAULT '0' NOT NULL, - `search_filter` varchar(255) DEFAULT '' NOT NULL, - `group_basedn` varchar(255) DEFAULT '' NOT NULL, - `group_name` varchar(255) DEFAULT '' NOT NULL, - `group_member` varchar(255) DEFAULT '' NOT NULL, - `user_ref_attr` varchar(255) DEFAULT '' NOT NULL, - `group_filter` varchar(255) DEFAULT '' NOT NULL, - `group_membership` varchar(255) DEFAULT '' NOT NULL, - `user_username` varchar(255) DEFAULT '' NOT NULL, - `user_lastname` varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (userdirectoryid) -) ENGINE=InnoDB; -CREATE TABLE `userdirectory_saml` ( - `userdirectoryid` bigint unsigned NOT NULL, - `idp_entityid` varchar(1024) DEFAULT '' NOT NULL, - `sso_url` varchar(2048) DEFAULT '' NOT NULL, - `slo_url` varchar(2048) DEFAULT '' NOT NULL, - `username_attribute` varchar(128) DEFAULT '' NOT NULL, - `sp_entityid` varchar(1024) DEFAULT '' NOT NULL, - `nameid_format` varchar(2048) DEFAULT '' NOT NULL, - `sign_messages` integer DEFAULT '0' NOT NULL, - `sign_assertions` integer DEFAULT '0' NOT NULL, - `sign_authn_requests` integer DEFAULT '0' NOT NULL, - `sign_logout_requests` integer DEFAULT '0' NOT NULL, - `sign_logout_responses` integer DEFAULT '0' NOT NULL, - `encrypt_nameid` integer DEFAULT '0' NOT NULL, - `encrypt_assertions` integer DEFAULT '0' NOT NULL, - `group_name` varchar(255) DEFAULT '' NOT NULL, - `user_username` varchar(255) DEFAULT '' NOT NULL, - `user_lastname` varchar(255) DEFAULT '' NOT NULL, - `scim_status` integer DEFAULT '0' NOT NULL, - PRIMARY KEY (userdirectoryid) -) ENGINE=InnoDB; -CREATE TABLE `userdirectory_media` ( - `userdirectory_mediaid` bigint unsigned NOT NULL, - `userdirectoryid` bigint unsigned NOT NULL, - `mediatypeid` bigint unsigned NOT NULL, - `name` varchar(64) DEFAULT '' NOT NULL, - `attribute` varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (userdirectory_mediaid) -) ENGINE=InnoDB; -CREATE INDEX `userdirectory_media_1` ON `userdirectory_media` (`userdirectoryid`); -CREATE INDEX `userdirectory_media_2` ON `userdirectory_media` (`mediatypeid`); -CREATE TABLE `userdirectory_usrgrp` ( - `userdirectory_usrgrpid` bigint unsigned NOT NULL, - `userdirectory_idpgroupid` bigint unsigned NOT NULL, - `usrgrpid` bigint unsigned NOT NULL, - PRIMARY KEY (userdirectory_usrgrpid) -) ENGINE=InnoDB; -CREATE UNIQUE INDEX `userdirectory_usrgrp_1` ON `userdirectory_usrgrp` (`userdirectory_idpgroupid`,`usrgrpid`); -CREATE INDEX `userdirectory_usrgrp_2` ON `userdirectory_usrgrp` (`usrgrpid`); -CREATE INDEX `userdirectory_usrgrp_3` ON `userdirectory_usrgrp` (`userdirectory_idpgroupid`); -CREATE TABLE `userdirectory_idpgroup` ( - `userdirectory_idpgroupid` bigint unsigned NOT NULL, - `userdirectoryid` bigint unsigned NOT NULL, - `roleid` bigint unsigned NOT NULL, - `name` varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (userdirectory_idpgroupid) -) ENGINE=InnoDB; -CREATE INDEX `userdirectory_idpgroup_1` ON `userdirectory_idpgroup` (`userdirectoryid`); -CREATE INDEX `userdirectory_idpgroup_2` ON `userdirectory_idpgroup` (`roleid`); -CREATE TABLE `changelog` ( - `changelogid` bigint unsigned NOT NULL auto_increment, - `object` integer DEFAULT '0' NOT NULL, - `objectid` bigint unsigned NOT NULL, - `operation` integer DEFAULT '0' NOT NULL, - `clock` integer DEFAULT '0' NOT NULL, - PRIMARY KEY (changelogid) -) ENGINE=InnoDB; -CREATE INDEX `changelog_1` ON `changelog` (`clock`); -CREATE TABLE `scim_group` ( - `scim_groupid` bigint unsigned NOT NULL, - `name` varchar(64) DEFAULT '' NOT NULL, - PRIMARY KEY (scim_groupid) -) ENGINE=InnoDB; -CREATE UNIQUE INDEX `scim_group_1` ON `scim_group` (`name`); -CREATE TABLE `user_scim_group` ( - `user_scim_groupid` bigint unsigned NOT NULL, - `userid` bigint unsigned NOT NULL, - `scim_groupid` bigint unsigned NOT NULL, - PRIMARY KEY (user_scim_groupid) -) ENGINE=InnoDB; -CREATE INDEX `user_scim_group_1` ON `user_scim_group` (`userid`); -CREATE INDEX `user_scim_group_2` ON `user_scim_group` (`scim_groupid`); -CREATE TABLE `connector` ( - `connectorid` bigint unsigned NOT NULL, - `name` varchar(255) DEFAULT '' NOT NULL, - `protocol` integer DEFAULT '0' NOT NULL, - `data_type` integer DEFAULT '0' NOT NULL, - `url` varchar(2048) DEFAULT '' NOT NULL, - `max_records` integer DEFAULT '0' NOT NULL, - `max_senders` integer DEFAULT '1' NOT NULL, - `max_attempts` integer DEFAULT '1' NOT NULL, - `timeout` varchar(255) DEFAULT '5s' NOT NULL, - `http_proxy` varchar(255) DEFAULT '' NOT NULL, - `authtype` integer DEFAULT '0' NOT NULL, - `username` varchar(64) DEFAULT '' NOT NULL, - `password` varchar(64) DEFAULT '' NOT NULL, - `token` varchar(128) DEFAULT '' NOT NULL, - `verify_peer` integer DEFAULT '1' NOT NULL, - `verify_host` 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, - `description` text NOT NULL, - `status` integer DEFAULT '1' NOT NULL, - `tags_evaltype` integer DEFAULT '0' NOT NULL, - PRIMARY KEY (connectorid) -) ENGINE=InnoDB; -CREATE UNIQUE INDEX `connector_1` ON `connector` (`name`); -CREATE TABLE `connector_tag` ( - `connector_tagid` bigint unsigned NOT NULL, - `connectorid` bigint unsigned NOT NULL, - `tag` varchar(255) DEFAULT '' NOT NULL, - `operator` integer DEFAULT '0' NOT NULL, - `value` varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (connector_tagid) -) ENGINE=InnoDB; -CREATE INDEX `connector_tag_1` ON `connector_tag` (`connectorid`); CREATE TABLE `dbversion` ( `dbversionid` bigint unsigned NOT NULL, `mandatory` integer DEFAULT '0' NOT NULL, `optional` integer DEFAULT '0' NOT NULL, PRIMARY KEY (dbversionid) ) ENGINE=InnoDB; -INSERT INTO dbversion VALUES ('1','6040000','6040026'); +INSERT INTO dbversion VALUES ('1','6000000','6000044'); DELIMITER $$ -create trigger hosts_insert after insert on hosts -for each row -insert into changelog (object,objectid,operation,clock) -values (1,new.hostid,1,unix_timestamp()); -$$ -create trigger hosts_update after update on hosts -for each row -insert into changelog (object,objectid,operation,clock) -values (1,old.hostid,2,unix_timestamp()); -$$ -create trigger hosts_delete before delete on hosts -for each row -insert into changelog (object,objectid,operation,clock) -values (1,old.hostid,3,unix_timestamp()); -$$ create trigger hosts_name_upper_insert before insert on hosts for each row set new.name_upper=upper(new.name) @@ -2304,81 +2123,6 @@ set new.name_upper=upper(new.name); end if; end;$$ -create trigger drules_insert after insert on drules -for each row -insert into changelog (object,objectid,operation,clock) -values (9,new.druleid,1,unix_timestamp()); -$$ -create trigger drules_update after update on drules -for each row -insert into changelog (object,objectid,operation,clock) -values (9,old.druleid,2,unix_timestamp()); -$$ -create trigger drules_delete before delete on drules -for each row -insert into changelog (object,objectid,operation,clock) -values (9,old.druleid,3,unix_timestamp()); -$$ -create trigger dchecks_insert after insert on dchecks -for each row -insert into changelog (object,objectid,operation,clock) -values (10,new.dcheckid,1,unix_timestamp()); -$$ -create trigger dchecks_update after update on dchecks -for each row -insert into changelog (object,objectid,operation,clock) -values (10,old.dcheckid,2,unix_timestamp()); -$$ -create trigger dchecks_delete before delete on dchecks -for each row -insert into changelog (object,objectid,operation,clock) -values (10,old.dcheckid,3,unix_timestamp()); -$$ -create trigger httptest_insert after insert on httptest -for each row -insert into changelog (object,objectid,operation,clock) -values (11,new.httptestid,1,unix_timestamp()); -$$ -create trigger httptest_update after update on httptest -for each row -insert into changelog (object,objectid,operation,clock) -values (11,old.httptestid,2,unix_timestamp()); -$$ -create trigger httptest_delete before delete on httptest -for each row -insert into changelog (object,objectid,operation,clock) -values (11,old.httptestid,3,unix_timestamp()); -$$ -create trigger httpstep_insert after insert on httpstep -for each row -insert into changelog (object,objectid,operation,clock) -values (14,new.httpstepid,1,unix_timestamp()); -$$ -create trigger httpstep_update after update on httpstep -for each row -insert into changelog (object,objectid,operation,clock) -values (14,old.httpstepid,2,unix_timestamp()); -$$ -create trigger httpstep_delete before delete on httpstep -for each row -insert into changelog (object,objectid,operation,clock) -values (14,old.httpstepid,3,unix_timestamp()); -$$ -create trigger items_insert after insert on items -for each row -insert into changelog (object,objectid,operation,clock) -values (3,new.itemid,1,unix_timestamp()); -$$ -create trigger items_update after update on items -for each row -insert into changelog (object,objectid,operation,clock) -values (3,old.itemid,2,unix_timestamp()); -$$ -create trigger items_delete before delete on items -for each row -insert into changelog (object,objectid,operation,clock) -values (3,old.itemid,3,unix_timestamp()); -$$ create trigger items_name_upper_insert before insert on items for each row set new.name_upper=upper(new.name) @@ -2391,216 +2135,34 @@ set new.name_upper=upper(new.name); end if; end;$$ -create trigger httpstepitem_insert after insert on httpstepitem -for each row -insert into changelog (object,objectid,operation,clock) -values (16,new.httpstepitemid,1,unix_timestamp()); -$$ -create trigger httpstepitem_update after update on httpstepitem -for each row -insert into changelog (object,objectid,operation,clock) -values (16,old.httpstepitemid,2,unix_timestamp()); -$$ -create trigger httpstepitem_delete before delete on httpstepitem -for each row -insert into changelog (object,objectid,operation,clock) -values (16,old.httpstepitemid,3,unix_timestamp()); -$$ -create trigger httptestitem_insert after insert on httptestitem -for each row -insert into changelog (object,objectid,operation,clock) -values (13,new.httptestitemid,1,unix_timestamp()); -$$ -create trigger httptestitem_update after update on httptestitem -for each row -insert into changelog (object,objectid,operation,clock) -values (13,old.httptestitemid,2,unix_timestamp()); -$$ -create trigger httptestitem_delete before delete on httptestitem -for each row -insert into changelog (object,objectid,operation,clock) -values (13,old.httptestitemid,3,unix_timestamp()); -$$ -create trigger triggers_insert after insert on triggers -for each row -insert into changelog (object,objectid,operation,clock) -values (5,new.triggerid,1,unix_timestamp()); -$$ -create trigger triggers_update after update on triggers -for each row -insert into changelog (object,objectid,operation,clock) -values (5,old.triggerid,2,unix_timestamp()); -$$ -create trigger triggers_delete before delete on triggers -for each row -insert into changelog (object,objectid,operation,clock) -values (5,old.triggerid,3,unix_timestamp()); -$$ -create trigger functions_insert after insert on functions -for each row -insert into changelog (object,objectid,operation,clock) -values (7,new.functionid,1,unix_timestamp()); -$$ -create trigger functions_update after update on functions -for each row -insert into changelog (object,objectid,operation,clock) -values (7,old.functionid,2,unix_timestamp()); -$$ -create trigger functions_delete before delete on functions -for each row -insert into changelog (object,objectid,operation,clock) -values (7,old.functionid,3,unix_timestamp()); -$$ -create trigger trigger_tag_insert after insert on trigger_tag -for each row -insert into changelog (object,objectid,operation,clock) -values (6,new.triggertagid,1,unix_timestamp()); -$$ -create trigger trigger_tag_update after update on trigger_tag -for each row -insert into changelog (object,objectid,operation,clock) -values (6,old.triggertagid,2,unix_timestamp()); -$$ -create trigger trigger_tag_delete before delete on trigger_tag -for each row -insert into changelog (object,objectid,operation,clock) -values (6,old.triggertagid,3,unix_timestamp()); -$$ -create trigger item_preproc_insert after insert on item_preproc -for each row -insert into changelog (object,objectid,operation,clock) -values (8,new.item_preprocid,1,unix_timestamp()); -$$ -create trigger item_preproc_update after update on item_preproc -for each row -insert into changelog (object,objectid,operation,clock) -values (8,old.item_preprocid,2,unix_timestamp()); -$$ -create trigger item_preproc_delete before delete on item_preproc -for each row -insert into changelog (object,objectid,operation,clock) -values (8,old.item_preprocid,3,unix_timestamp()); -$$ -create trigger httptest_field_insert after insert on httptest_field -for each row -insert into changelog (object,objectid,operation,clock) -values (12,new.httptest_fieldid,1,unix_timestamp()); -$$ -create trigger httptest_field_update after update on httptest_field -for each row -insert into changelog (object,objectid,operation,clock) -values (12,old.httptest_fieldid,2,unix_timestamp()); -$$ -create trigger httptest_field_delete before delete on httptest_field -for each row -insert into changelog (object,objectid,operation,clock) -values (12,old.httptest_fieldid,3,unix_timestamp()); -$$ -create trigger httpstep_field_insert after insert on httpstep_field -for each row -insert into changelog (object,objectid,operation,clock) -values (15,new.httpstep_fieldid,1,unix_timestamp()); -$$ -create trigger httpstep_field_update after update on httpstep_field -for each row -insert into changelog (object,objectid,operation,clock) -values (15,old.httpstep_fieldid,2,unix_timestamp()); -$$ -create trigger httpstep_field_delete before delete on httpstep_field -for each row -insert into changelog (object,objectid,operation,clock) -values (15,old.httpstep_fieldid,3,unix_timestamp()); -$$ -create trigger host_tag_insert after insert on host_tag -for each row -insert into changelog (object,objectid,operation,clock) -values (2,new.hosttagid,1,unix_timestamp()); -$$ -create trigger host_tag_update after update on host_tag -for each row -insert into changelog (object,objectid,operation,clock) -values (2,old.hosttagid,2,unix_timestamp()); -$$ -create trigger host_tag_delete before delete on host_tag -for each row -insert into changelog (object,objectid,operation,clock) -values (2,old.hosttagid,3,unix_timestamp()); -$$ -create trigger item_tag_insert after insert on item_tag -for each row -insert into changelog (object,objectid,operation,clock) -values (4,new.itemtagid,1,unix_timestamp()); -$$ -create trigger item_tag_update after update on item_tag -for each row -insert into changelog (object,objectid,operation,clock) -values (4,old.itemtagid,2,unix_timestamp()); -$$ -create trigger item_tag_delete before delete on item_tag -for each row -insert into changelog (object,objectid,operation,clock) -values (4,old.itemtagid,3,unix_timestamp()); -$$ -create trigger connector_insert after insert on connector -for each row -insert into changelog (object,objectid,operation,clock) -values (17,new.connectorid,1,unix_timestamp()); -$$ -create trigger connector_update after update on connector -for each row -insert into changelog (object,objectid,operation,clock) -values (17,old.connectorid,2,unix_timestamp()); -$$ -create trigger connector_delete before delete on connector -for each row -insert into changelog (object,objectid,operation,clock) -values (17,old.connectorid,3,unix_timestamp()); -$$ -create trigger connector_tag_insert after insert on connector_tag -for each row -insert into changelog (object,objectid,operation,clock) -values (18,new.connector_tagid,1,unix_timestamp()); -$$ -create trigger connector_tag_update after update on connector_tag -for each row -insert into changelog (object,objectid,operation,clock) -values (18,old.connector_tagid,2,unix_timestamp()); -$$ -create trigger connector_tag_delete before delete on connector_tag -for each row -insert into changelog (object,objectid,operation,clock) -values (18,old.connector_tagid,3,unix_timestamp()); -$$ DELIMITER ; ALTER TABLE `users` ADD CONSTRAINT `c_users_1` FOREIGN KEY (`roleid`) REFERENCES `role` (`roleid`) ON DELETE CASCADE; -ALTER TABLE `users` ADD CONSTRAINT `c_users_2` FOREIGN KEY (`userdirectoryid`) REFERENCES `userdirectory` (`userdirectoryid`); 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`); +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 `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`); -ALTER TABLE `httptest` ADD CONSTRAINT `c_httptest_2` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`); -ALTER TABLE `httptest` ADD CONSTRAINT `c_httptest_3` FOREIGN KEY (`templateid`) REFERENCES `httptest` (`httptestid`); -ALTER TABLE `httpstep` ADD CONSTRAINT `c_httpstep_1` FOREIGN KEY (`httptestid`) REFERENCES `httptest` (`httptestid`); +ALTER TABLE `dchecks` ADD CONSTRAINT `c_dchecks_1` FOREIGN KEY (`druleid`) REFERENCES `drules` (`druleid`) ON DELETE CASCADE; +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 `valuemap` ADD CONSTRAINT `c_valuemap_1` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE; -ALTER TABLE `items` ADD CONSTRAINT `c_items_1` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`); -ALTER TABLE `items` ADD CONSTRAINT `c_items_2` FOREIGN KEY (`templateid`) REFERENCES `items` (`itemid`); +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 `valuemap` (`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`); -ALTER TABLE `httpstepitem` ADD CONSTRAINT `c_httpstepitem_1` FOREIGN KEY (`httpstepid`) REFERENCES `httpstep` (`httpstepid`); -ALTER TABLE `httpstepitem` ADD CONSTRAINT `c_httpstepitem_2` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`); -ALTER TABLE `httptestitem` ADD CONSTRAINT `c_httptestitem_1` FOREIGN KEY (`httptestid`) REFERENCES `httptest` (`httptestid`); -ALTER TABLE `httptestitem` ADD CONSTRAINT `c_httptestitem_2` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`); +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 `media_type_param` ADD CONSTRAINT `c_media_type_param_1` FOREIGN KEY (`mediatypeid`) REFERENCES `media_type` (`mediatypeid`) ON DELETE CASCADE; ALTER TABLE `media_type_message` ADD CONSTRAINT `c_media_type_message_1` FOREIGN KEY (`mediatypeid`) REFERENCES `media_type` (`mediatypeid`) ON DELETE CASCADE; -ALTER TABLE `usrgrp` ADD CONSTRAINT `c_usrgrp_2` FOREIGN KEY (`userdirectoryid`) REFERENCES `userdirectory` (`userdirectoryid`); 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`); @@ -2627,13 +2189,11 @@ 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 `config` ADD CONSTRAINT `c_config_3` FOREIGN KEY (`ldap_userdirectoryid`) REFERENCES `userdirectory` (`userdirectoryid`); -ALTER TABLE `config` ADD CONSTRAINT `c_config_4` FOREIGN KEY (`disabled_usrgrpid`) REFERENCES `usrgrp` (`usrgrpid`); -ALTER TABLE `triggers` ADD CONSTRAINT `c_triggers_1` FOREIGN KEY (`templateid`) REFERENCES `triggers` (`triggerid`); +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`); -ALTER TABLE `functions` ADD CONSTRAINT `c_functions_2` FOREIGN KEY (`triggerid`) REFERENCES `triggers` (`triggerid`); +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`); @@ -2686,8 +2246,6 @@ 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 `event_symptom` ADD CONSTRAINT `c_event_symptom_1` FOREIGN KEY (`eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE; -ALTER TABLE `event_symptom` ADD CONSTRAINT `c_event_symptom_2` FOREIGN KEY (`cause_eventid`) REFERENCES `events` (`eventid`); 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 `service_alarms` ADD CONSTRAINT `c_service_alarms_1` FOREIGN KEY (`serviceid`) REFERENCES `services` (`serviceid`) ON DELETE CASCADE; @@ -2712,11 +2270,10 @@ ALTER TABLE `item_condition` ADD CONSTRAINT `c_item_condition_1` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE; ALTER TABLE `item_rtdata` ADD CONSTRAINT `c_item_rtdata_1` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) 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`); +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` ADD CONSTRAINT `c_problem_3` FOREIGN KEY (`cause_eventid`) REFERENCES `events` (`eventid`); 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; @@ -2732,7 +2289,7 @@ 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`); +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_data` ADD CONSTRAINT `c_task_data_1` FOREIGN KEY (`taskid`) REFERENCES `task` (`taskid`) ON DELETE CASCADE; @@ -2741,8 +2298,8 @@ 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`); -ALTER TABLE `httpstep_field` ADD CONSTRAINT `c_httpstep_field_1` FOREIGN KEY (`httpstepid`) REFERENCES `httpstep` (`httpstepid`); +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` ADD CONSTRAINT `c_dashboard_2` FOREIGN KEY (`templateid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE; ALTER TABLE `dashboard_user` ADD CONSTRAINT `c_dashboard_user_1` FOREIGN KEY (`dashboardid`) REFERENCES `dashboard` (`dashboardid`) ON DELETE CASCADE; @@ -2759,16 +2316,12 @@ ALTER TABLE `widget_field` ADD CONSTRAINT `c_widget_field_6` FOREIGN KEY (`value_sysmapid`) REFERENCES `sysmaps` (`sysmapid`) ON DELETE CASCADE; ALTER TABLE `widget_field` ADD CONSTRAINT `c_widget_field_7` FOREIGN KEY (`value_serviceid`) REFERENCES `services` (`serviceid`) ON DELETE CASCADE; ALTER TABLE `widget_field` ADD CONSTRAINT `c_widget_field_8` FOREIGN KEY (`value_slaid`) REFERENCES `sla` (`slaid`) ON DELETE CASCADE; -ALTER TABLE `widget_field` ADD CONSTRAINT `c_widget_field_9` FOREIGN KEY (`value_userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE; -ALTER TABLE `widget_field` ADD CONSTRAINT `c_widget_field_10` FOREIGN KEY (`value_actionid`) REFERENCES `actions` (`actionid`) ON DELETE CASCADE; -ALTER TABLE `widget_field` ADD CONSTRAINT `c_widget_field_11` FOREIGN KEY (`value_mediatypeid`) REFERENCES `media_type` (`mediatypeid`) 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 `event_suppress` ADD CONSTRAINT `c_event_suppress_3` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) 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`); +ALTER TABLE `host_tag` ADD CONSTRAINT `c_host_tag_1` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE; ALTER TABLE `interface_snmp` ADD CONSTRAINT `c_interface_snmp_1` FOREIGN KEY (`interfaceid`) REFERENCES `interface` (`interfaceid`) ON DELETE CASCADE; ALTER TABLE `lld_override` ADD CONSTRAINT `c_lld_override_1` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE; ALTER TABLE `lld_override_condition` ADD CONSTRAINT `c_lld_override_condition_1` FOREIGN KEY (`lld_overrideid`) REFERENCES `lld_override` (`lld_overrideid`) ON DELETE CASCADE; @@ -2789,7 +2342,7 @@ ALTER TABLE `role_rule` ADD CONSTRAINT `c_role_rule_3` FOREIGN KEY (`value_serviceid`) REFERENCES `services` (`serviceid`) ON DELETE CASCADE; ALTER TABLE `token` ADD CONSTRAINT `c_token_1` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE; ALTER TABLE `token` ADD CONSTRAINT `c_token_2` FOREIGN KEY (`creator_userid`) REFERENCES `users` (`userid`); -ALTER TABLE `item_tag` ADD CONSTRAINT `c_item_tag_1` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`); +ALTER TABLE `item_tag` ADD CONSTRAINT `c_item_tag_1` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE; ALTER TABLE `httptest_tag` ADD CONSTRAINT `c_httptest_tag_1` FOREIGN KEY (`httptestid`) REFERENCES `httptest` (`httptestid`) ON DELETE CASCADE; ALTER TABLE `sysmaps_element_tag` ADD CONSTRAINT `c_sysmaps_element_tag_1` FOREIGN KEY (`selementid`) REFERENCES `sysmaps_elements` (`selementid`) ON DELETE CASCADE; ALTER TABLE `report` ADD CONSTRAINT `c_report_1` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE; @@ -2809,15 +2362,3 @@ ALTER TABLE `sla_schedule` ADD CONSTRAINT `c_sla_schedule_1` FOREIGN KEY (`slaid`) REFERENCES `sla` (`slaid`) ON DELETE CASCADE; ALTER TABLE `sla_excluded_downtime` ADD CONSTRAINT `c_sla_excluded_downtime_1` FOREIGN KEY (`slaid`) REFERENCES `sla` (`slaid`) ON DELETE CASCADE; ALTER TABLE `sla_service_tag` ADD CONSTRAINT `c_sla_service_tag_1` FOREIGN KEY (`slaid`) REFERENCES `sla` (`slaid`) ON DELETE CASCADE; -ALTER TABLE `host_rtdata` ADD CONSTRAINT `c_host_rtdata_1` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE; -ALTER TABLE `userdirectory_ldap` ADD CONSTRAINT `c_userdirectory_ldap_1` FOREIGN KEY (`userdirectoryid`) REFERENCES `userdirectory` (`userdirectoryid`) ON DELETE CASCADE; -ALTER TABLE `userdirectory_saml` ADD CONSTRAINT `c_userdirectory_saml_1` FOREIGN KEY (`userdirectoryid`) REFERENCES `userdirectory` (`userdirectoryid`) ON DELETE CASCADE; -ALTER TABLE `userdirectory_media` ADD CONSTRAINT `c_userdirectory_media_1` FOREIGN KEY (`userdirectoryid`) REFERENCES `userdirectory` (`userdirectoryid`) ON DELETE CASCADE; -ALTER TABLE `userdirectory_media` ADD CONSTRAINT `c_userdirectory_media_2` FOREIGN KEY (`mediatypeid`) REFERENCES `media_type` (`mediatypeid`) ON DELETE CASCADE; -ALTER TABLE `userdirectory_usrgrp` ADD CONSTRAINT `c_userdirectory_usrgrp_1` FOREIGN KEY (`userdirectory_idpgroupid`) REFERENCES `userdirectory_idpgroup` (`userdirectory_idpgroupid`) ON DELETE CASCADE; -ALTER TABLE `userdirectory_usrgrp` ADD CONSTRAINT `c_userdirectory_usrgrp_2` FOREIGN KEY (`usrgrpid`) REFERENCES `usrgrp` (`usrgrpid`) ON DELETE CASCADE; -ALTER TABLE `userdirectory_idpgroup` ADD CONSTRAINT `c_userdirectory_idpgroup_1` FOREIGN KEY (`userdirectoryid`) REFERENCES `userdirectory` (`userdirectoryid`) ON DELETE CASCADE; -ALTER TABLE `userdirectory_idpgroup` ADD CONSTRAINT `c_userdirectory_idpgroup_2` FOREIGN KEY (`roleid`) REFERENCES `role` (`roleid`) ON DELETE CASCADE; -ALTER TABLE `user_scim_group` ADD CONSTRAINT `c_user_scim_group_1` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE; -ALTER TABLE `user_scim_group` ADD CONSTRAINT `c_user_scim_group_2` FOREIGN KEY (`scim_groupid`) REFERENCES `scim_group` (`scim_groupid`) ON DELETE CASCADE; -ALTER TABLE `connector_tag` ADD CONSTRAINT `c_connector_tag_1` FOREIGN KEY (`connectorid`) REFERENCES `connector` (`connectorid`);