]> granicus.if.org Git - icinga2/blob - lib/db_ido_mysql/schema/upgrade/2.4.0.sql
ido/mysql: Fix IDO upgrade compliance against MySQL 5.7
[icinga2] / lib / db_ido_mysql / schema / upgrade / 2.4.0.sql
1 -- -----------------------------------------
2 -- upgrade path for Icinga 2.4.0
3 --
4 -- -----------------------------------------
5 -- Copyright (c) 2015 Icinga Development Team (https://www.icinga.com)
6 --
7 -- Please check http://docs.icinga.com for upgrading information!
8 -- -----------------------------------------
9
10 -- -----------------------------------------
11 -- #9286 - zone tables
12 -- -----------------------------------------
13
14 ALTER TABLE icinga_endpoints ADD COLUMN zone_object_id bigint(20) unsigned DEFAULT '0';
15 ALTER TABLE icinga_endpointstatus ADD COLUMN zone_object_id bigint(20) unsigned DEFAULT '0';
16
17 CREATE TABLE IF NOT EXISTS icinga_zones (
18   zone_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
19   instance_id bigint unsigned default 0,
20   zone_object_id bigint(20) unsigned DEFAULT '0',
21   config_type smallint(6) DEFAULT '0',
22   parent_zone_object_id bigint(20) unsigned DEFAULT '0',
23   is_global smallint(6),
24   PRIMARY KEY  (zone_id)
25 ) ENGINE=InnoDB COMMENT='Zone configuration';
26
27 CREATE TABLE IF NOT EXISTS icinga_zonestatus (
28   zonestatus_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
29   instance_id bigint unsigned default 0,
30   zone_object_id bigint(20) unsigned DEFAULT '0',
31   status_update_time timestamp NOT NULL,
32   parent_zone_object_id bigint(20) unsigned DEFAULT '0',
33   PRIMARY KEY  (zonestatus_id)
34 ) ENGINE=InnoDB COMMENT='Zone status';
35
36
37 -- -----------------------------------------
38 -- #9576 - freshness_threshold
39 -- -----------------------------------------
40
41 ALTER TABLE icinga_services MODIFY freshness_threshold int;
42 ALTER TABLE icinga_hosts MODIFY freshness_threshold int;
43
44 -- -----------------------------------------
45 -- #10392 - original attributes
46 -- -----------------------------------------
47
48 ALTER TABLE icinga_servicestatus ADD COLUMN original_attributes TEXT character set latin1  default NULL;
49 ALTER TABLE icinga_hoststatus ADD COLUMN original_attributes TEXT character set latin1  default NULL;
50
51 -- -----------------------------------------
52 -- #10436 deleted custom vars
53 -- -----------------------------------------
54
55 ALTER TABLE icinga_customvariables ADD COLUMN session_token int default NULL;
56 ALTER TABLE icinga_customvariablestatus ADD COLUMN session_token int default NULL;
57
58 CREATE INDEX cv_session_del_idx ON icinga_customvariables (session_token);
59 CREATE INDEX cvs_session_del_idx ON icinga_customvariablestatus (session_token);
60
61 -- -----------------------------------------
62 -- #10431 comment/downtime name
63 -- -----------------------------------------
64
65 ALTER TABLE icinga_comments ADD COLUMN name TEXT character set latin1 default NULL;
66 ALTER TABLE icinga_commenthistory ADD COLUMN name TEXT character set latin1 default NULL;
67
68 ALTER TABLE icinga_scheduleddowntime ADD COLUMN name TEXT character set latin1 default NULL;
69 ALTER TABLE icinga_downtimehistory ADD COLUMN name TEXT character set latin1 default NULL;
70
71 -- -----------------------------------------
72 -- update dbversion
73 -- -----------------------------------------
74
75 INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.14.0', NOW(), NOW()) ON DUPLICATE KEY UPDATE version='1.14.0', modify_time=NOW();