diff --git a/module/idoutils/db/mysql/mysql.sql b/module/idoutils/db/mysql/mysql.sql index f66aa306c..ea004edd4 100644 --- a/module/idoutils/db/mysql/mysql.sql +++ b/module/idoutils/db/mysql/mysql.sql @@ -82,6 +82,7 @@ CREATE TABLE IF NOT EXISTS icinga_commenthistory ( expiration_time timestamp default '0000-00-00 00:00:00', deletion_time timestamp default '0000-00-00 00:00:00', deletion_time_usec int default 0, + unique_id TEXT character set latin1 default NULL, PRIMARY KEY (commenthistory_id), UNIQUE KEY instance_id (instance_id,object_id,comment_time,internal_comment_id) ) ENGINE=InnoDB COMMENT='Historical host and service comments'; @@ -108,6 +109,7 @@ CREATE TABLE IF NOT EXISTS icinga_comments ( comment_source smallint default 0, expires smallint default 0, expiration_time timestamp default '0000-00-00 00:00:00', + unique_id TEXT character set latin1 default NULL, PRIMARY KEY (comment_id), UNIQUE KEY instance_id (instance_id,object_id,comment_time,internal_comment_id) ) ENGINE=InnoDB COMMENT='Usercomments on Icinga objects'; @@ -340,6 +342,7 @@ CREATE TABLE IF NOT EXISTS icinga_customvariables ( varname varchar(255) character set latin1 collate latin1_general_cs default NULL, varvalue TEXT character set latin1 default '', is_json smallint default 0, + session_token varchar(512) character set latin1 default NULL, PRIMARY KEY (customvariable_id), UNIQUE KEY object_id_2 (object_id,config_type,varname), KEY varname (varname) @@ -360,6 +363,7 @@ CREATE TABLE IF NOT EXISTS icinga_customvariablestatus ( varname varchar(255) character set latin1 collate latin1_general_cs default NULL, varvalue TEXT character set latin1 default '', is_json smallint default 0, + session_token varchar(512) character set latin1 default NULL, PRIMARY KEY (customvariablestatus_id), UNIQUE KEY object_id_2 (object_id,varname), KEY varname (varname) @@ -409,6 +413,7 @@ CREATE TABLE IF NOT EXISTS icinga_downtimehistory ( was_cancelled smallint default 0, is_in_effect smallint default 0, trigger_time timestamp default '0000-00-00 00:00:00', + unique_id TEXT character set latin1 default NULL, PRIMARY KEY (downtimehistory_id), UNIQUE KEY instance_id (instance_id,object_id,entry_time,internal_downtime_id) ) ENGINE=InnoDB COMMENT='Historical scheduled host and service downtime'; @@ -666,7 +671,7 @@ CREATE TABLE IF NOT EXISTS icinga_hosts ( high_flap_threshold double default '0', process_performance_data smallint default 0, freshness_checks_enabled smallint default 0, - freshness_threshold smallint default 0, + freshness_threshold int default 0, passive_checks_enabled smallint default 0, event_handler_enabled smallint default 0, active_checks_enabled smallint default 0, @@ -744,6 +749,7 @@ CREATE TABLE IF NOT EXISTS icinga_hoststatus ( process_performance_data smallint default 0, obsess_over_host smallint default 0, modified_host_attributes int default 0, + original_attributes TEXT character set latin1 default NULL, event_handler TEXT character set latin1 default '', check_command TEXT character set latin1 default '', normal_check_interval double default '0', @@ -969,6 +975,7 @@ CREATE TABLE IF NOT EXISTS icinga_scheduleddowntime ( actual_start_time_usec int default 0, is_in_effect smallint default 0, trigger_time timestamp default '0000-00-00 00:00:00', + unique_id TEXT character set latin1 default NULL, PRIMARY KEY (scheduleddowntime_id), UNIQUE KEY instance_id (instance_id,object_id,entry_time,internal_downtime_id) ) ENGINE=InnoDB COMMENT='Current scheduled host and service downtime'; @@ -1160,7 +1167,7 @@ CREATE TABLE IF NOT EXISTS icinga_services ( high_flap_threshold double default '0', process_performance_data smallint default 0, freshness_checks_enabled smallint default 0, - freshness_threshold smallint default 0, + freshness_threshold int default 0, passive_checks_enabled smallint default 0, event_handler_enabled smallint default 0, active_checks_enabled smallint default 0, @@ -1230,6 +1237,7 @@ CREATE TABLE IF NOT EXISTS icinga_servicestatus ( process_performance_data smallint default 0, obsess_over_service smallint default 0, modified_service_attributes int default 0, + original_attributes TEXT character set latin1 default NULL, event_handler TEXT character set latin1 default '', check_command TEXT character set latin1 default '', normal_check_interval double default '0', @@ -1362,6 +1370,7 @@ CREATE TABLE IF NOT EXISTS icinga_endpoints ( endpoint_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, instance_id bigint unsigned default 0, endpoint_object_id bigint(20) unsigned DEFAULT '0', + zone_object_id bigint(20) unsigned DEFAULT '0', config_type smallint(6) DEFAULT '0', identity varchar(255) DEFAULT NULL, node varchar(255) DEFAULT NULL, @@ -1378,6 +1387,7 @@ CREATE TABLE IF NOT EXISTS icinga_endpointstatus ( endpointstatus_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, instance_id bigint unsigned default 0, endpoint_object_id bigint(20) unsigned DEFAULT '0', + zone_object_id bigint(20) unsigned DEFAULT '0', status_update_time timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', identity varchar(255) DEFAULT NULL, node varchar(255) DEFAULT NULL, @@ -1385,6 +1395,37 @@ CREATE TABLE IF NOT EXISTS icinga_endpointstatus ( PRIMARY KEY (endpointstatus_id) ) ENGINE=InnoDB COMMENT='Endpoint status'; +-- +-- Table structure for table icinga_zones +-- + +CREATE TABLE IF NOT EXISTS icinga_zones ( + zone_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, + instance_id bigint unsigned default 0, + zone_object_id bigint(20) unsigned DEFAULT '0', + config_type smallint(6) DEFAULT '0', + parent_zone_object_id bigint(20) unsigned DEFAULT '0', + is_global smallint(6), + PRIMARY KEY (zone_id) +) ENGINE=InnoDB COMMENT='Zone configuration'; + +-- -------------------------------------------------------- + +-- +-- Table structure for table icinga_zonestatus +-- + +CREATE TABLE IF NOT EXISTS icinga_zonestatus ( + zonestatus_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, + instance_id bigint unsigned default 0, + zone_object_id bigint(20) unsigned DEFAULT '0', + status_update_time timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + parent_zone_object_id bigint(20) unsigned DEFAULT '0', + PRIMARY KEY (zonestatus_id) +) ENGINE=InnoDB COMMENT='Zone status'; + + + ALTER TABLE icinga_servicestatus ADD COLUMN endpoint_object_id bigint default NULL; ALTER TABLE icinga_hoststatus ADD COLUMN endpoint_object_id bigint default NULL; @@ -1600,9 +1641,13 @@ CREATE INDEX sla_idx_obj ON icinga_objects (objecttype_id, is_active, name1); -- #4985 CREATE INDEX commenthistory_delete_idx ON icinga_commenthistory (instance_id, comment_time, internal_comment_id); +-- #10436 +CREATE INDEX cv_session_del_idx ON icinga_customvariables (session_token); +CREATE INDEX cvs_session_del_idx ON icinga_customvariablestatus (session_token); + -- ----------------------------------------- -- set dbversion -- ----------------------------------------- -INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.13.0', NOW(), NOW()) ON DUPLICATE KEY UPDATE version='1.13.0', modify_time=NOW(); +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(); diff --git a/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.14.0.sql b/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.14.0.sql new file mode 100644 index 000000000..a7bf0fcb0 --- /dev/null +++ b/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.14.0.sql @@ -0,0 +1,75 @@ +-- ----------------------------------------- +-- upgrade path for Icinga 2.4.0 +-- +-- ----------------------------------------- +-- Copyright (c) 2015 Icinga Development Team (http://www.icinga.org) +-- +-- Please check http://docs.icinga.org for upgrading information! +-- ----------------------------------------- + +-- ----------------------------------------- +-- #9286 - zone tables +-- ----------------------------------------- + +ALTER TABLE icinga_endpoints ADD COLUMN zone_object_id bigint(20) unsigned DEFAULT '0'; +ALTER TABLE icinga_endpointstatus ADD COLUMN zone_object_id bigint(20) unsigned DEFAULT '0'; + +CREATE TABLE IF NOT EXISTS icinga_zones ( + zone_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, + instance_id bigint unsigned default 0, + zone_object_id bigint(20) unsigned DEFAULT '0', + config_type smallint(6) DEFAULT '0', + parent_zone_object_id bigint(20) unsigned DEFAULT '0', + is_global smallint(6), + PRIMARY KEY (zone_id) +) ENGINE=InnoDB COMMENT='Zone configuration'; + +CREATE TABLE IF NOT EXISTS icinga_zonestatus ( + zonestatus_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, + instance_id bigint unsigned default 0, + zone_object_id bigint(20) unsigned DEFAULT '0', + status_update_time timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + parent_zone_object_id bigint(20) unsigned DEFAULT '0', + PRIMARY KEY (zonestatus_id) +) ENGINE=InnoDB COMMENT='Zone status'; + + +-- ----------------------------------------- +-- #9576 - freshness_threshold +-- ----------------------------------------- + +ALTER TABLE icinga_services MODIFY freshness_threshold int; +ALTER TABLE icinga_hosts MODIFY freshness_threshold int; + +-- ----------------------------------------- +-- #10392 - original attributes +-- ----------------------------------------- + +ALTER TABLE icinga_servicestatus ADD COLUMN original_attributes TEXT character set latin1 default NULL; +ALTER TABLE icinga_hoststatus ADD COLUMN original_attributes TEXT character set latin1 default NULL; + +-- ----------------------------------------- +-- #10436 deleted custom vars +-- ----------------------------------------- + +ALTER TABLE icinga_customvariables ADD COLUMN session_token varchar(512) character set latin1 default NULL; +ALTER TABLE icinga_customvariablestatus ADD COLUMN session_token varchar(512) character set latin1 default NULL; + +CREATE INDEX cv_session_del_idx ON icinga_customvariables (session_token); +CREATE INDEX cvs_session_del_idx ON icinga_customvariablestatus (session_token); + +-- ----------------------------------------- +-- #10431 comment/downtime unique id +-- ----------------------------------------- + +ALTER TABLE icinga_comments ADD COLUMN unique_id TEXT character set latin1 default NULL; +ALTER TABLE icinga_commenthistory ADD COLUMN unique_id TEXT character set latin1 default NULL; + +ALTER TABLE icinga_scheduleddowntime ADD COLUMN unique_id TEXT character set latin1 default NULL; +ALTER TABLE icinga_downtimehistory ADD COLUMN unique_id TEXT character set latin1 default NULL; + +-- ----------------------------------------- +-- update dbversion +-- ----------------------------------------- + +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(); diff --git a/module/idoutils/db/oracle/oracle.sql b/module/idoutils/db/oracle/oracle.sql index f2988fc07..cbc1fe53a 100644 --- a/module/idoutils/db/oracle/oracle.sql +++ b/module/idoutils/db/oracle/oracle.sql @@ -17,7 +17,7 @@ -- -- -------------------------------------------------------- */ -DEFINE ICINGA_VERSION=1.13.0 +DEFINE ICINGA_VERSION=1.14.0 -- ----------------------------------------- -- set defines diff --git a/module/idoutils/db/oracle/upgrade/oracle-upgrade-1.14.0.sql b/module/idoutils/db/oracle/upgrade/oracle-upgrade-1.14.0.sql new file mode 100644 index 000000000..bf0cc3148 --- /dev/null +++ b/module/idoutils/db/oracle/upgrade/oracle-upgrade-1.14.0.sql @@ -0,0 +1,57 @@ +-- ----------------------------------------- +-- upgrade path for Icinga IDOUtils 1.14.0 +-- +-- run it as icinga database user from whithin current directory +-- sqlplus icinga@ @ oracle-upgrade-1.14.0.sql + +-- ----------------------------------------- +-- Copyright (c) 2014 Icinga Development Team (http://www.icinga.org) +-- +-- Please check http://docs.icinga.org for upgrading information! +-- ----------------------------------------- +set sqlprompt "&&_USER@&&_CONNECT_IDENTIFIER SQL>" +set pagesize 200; +set linesize 200; +set heading on; +set echo on; +set feedback on; + +define ICINGA_VERSION=1.14.0 + +-- -------------------------------------------------------- +-- warning: edit this script to define existing tablespaces +-- this particular step can be skipped safely if no new +-- table or index included +-- -------------------------------------------------------- +/* set real TBS names on which you have quota, no checks are implemented!*/ +define DATATBS='ICINGA_DATA1'; +define LOBTBS='ICINGA_LOB1'; +define IDXTBS='ICINGA_IDX1'; + +/* load defines from file, if any */ +@icinga_defines.sql + +/* script will be terminated on the first error */ +whenever sqlerror exit failure +spool oracle-upgrade-&&ICINGA_VERSION..log + + +-- ----------------------------------------- +-- finally update dbversion +-- ----------------------------------------- + +MERGE INTO dbversion + USING DUAL ON (name='idoutils') + WHEN MATCHED THEN + UPDATE SET version='&&ICINGA_VERSION', modify_time=CURRENT_TIMESTAMP + WHEN NOT MATCHED THEN + INSERT (id, name, version, create_time, modify_time) VALUES ('1', 'idoutils', '&&ICINGA_VERSION', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); +commit; + +/* last check */ +select object_name,object_type,status from user_objects where status !='VALID'; + +/* goodbye */ +spool off +exit; + diff --git a/module/idoutils/db/pgsql/pgsql.sql b/module/idoutils/db/pgsql/pgsql.sql index 0c90c1249..8b9a8ce7f 100644 --- a/module/idoutils/db/pgsql/pgsql.sql +++ b/module/idoutils/db/pgsql/pgsql.sql @@ -54,7 +54,7 @@ $$ LANGUAGE plpgsql; CREATE TABLE icinga_acknowledgements ( acknowledgement_id bigserial, instance_id bigint default 0, - entry_time timestamp with time zone default '1970-01-01 00:00:00', + entry_time timestamp with time zone default '1970-01-01 00:00:00+00', entry_time_usec INTEGER default 0, acknowledgement_type INTEGER default 0, object_id bigint default 0, @@ -64,8 +64,8 @@ CREATE TABLE icinga_acknowledgements ( is_sticky INTEGER default 0, persistent_comment INTEGER default 0, notify_contacts INTEGER default 0, - end_time timestamp with time zone default '1970-01-01 00:00:00', - CONSTRAINT PK_acknowledgement_id PRIMARY KEY (acknowledgement_id) + end_time timestamp with time zone default '1970-01-01 00:00:00+00', + CONSTRAINT PK_acknowledgement_id PRIMARY KEY (acknowledgement_id) ) ; -- -------------------------------------------------------- @@ -93,21 +93,22 @@ CREATE TABLE icinga_commands ( CREATE TABLE icinga_commenthistory ( commenthistory_id bigserial, instance_id bigint default 0, - entry_time timestamp with time zone default '1970-01-01 00:00:00', + entry_time timestamp with time zone default '1970-01-01 00:00:00+00', entry_time_usec INTEGER default 0, comment_type INTEGER default 0, entry_type INTEGER default 0, object_id bigint default 0, - comment_time timestamp with time zone default '1970-01-01 00:00:00', + comment_time timestamp with time zone default '1970-01-01 00:00:00+00', internal_comment_id bigint default 0, author_name TEXT default '', comment_data TEXT default '', is_persistent INTEGER default 0, comment_source INTEGER default 0, expires INTEGER default 0, - expiration_time timestamp with time zone default '1970-01-01 00:00:00', - deletion_time timestamp with time zone default '1970-01-01 00:00:00', + expiration_time timestamp with time zone default '1970-01-01 00:00:00+00', + deletion_time timestamp with time zone default '1970-01-01 00:00:00+00', deletion_time_usec INTEGER default 0, + unique_id TEXT default NULL, CONSTRAINT PK_commenthistory_id PRIMARY KEY (commenthistory_id) , CONSTRAINT UQ_commenthistory UNIQUE (instance_id,object_id,comment_time,internal_comment_id) ); @@ -121,19 +122,20 @@ CREATE TABLE icinga_commenthistory ( CREATE TABLE icinga_comments ( comment_id bigserial, instance_id bigint default 0, - entry_time timestamp with time zone default '1970-01-01 00:00:00', + entry_time timestamp with time zone default '1970-01-01 00:00:00+00', entry_time_usec INTEGER default 0, comment_type INTEGER default 0, entry_type INTEGER default 0, object_id bigint default 0, - comment_time timestamp with time zone default '1970-01-01 00:00:00', + comment_time timestamp with time zone default '1970-01-01 00:00:00+00', internal_comment_id bigint default 0, author_name TEXT default '', comment_data TEXT default '', is_persistent INTEGER default 0, comment_source INTEGER default 0, expires INTEGER default 0, - expiration_time timestamp with time zone default '1970-01-01 00:00:00', + expiration_time timestamp with time zone default '1970-01-01 00:00:00+00', + unique_id TEXT default NULL, CONSTRAINT PK_comment_id PRIMARY KEY (comment_id) , CONSTRAINT UQ_comments UNIQUE (instance_id,object_id,comment_time,internal_comment_id) ) ; @@ -165,7 +167,7 @@ CREATE TABLE icinga_configfilevariables ( configfile_id bigint default 0, varname TEXT default '', varvalue TEXT default '', - CONSTRAINT PK_configfilevariable_id PRIMARY KEY (configfilevariable_id) + CONSTRAINT PK_configfilevariable_id PRIMARY KEY (configfilevariable_id) ) ; -- -------------------------------------------------------- @@ -182,15 +184,15 @@ CREATE TABLE icinga_conninfo ( disposition TEXT default '', connect_source TEXT default '', connect_type TEXT default '', - connect_time timestamp with time zone default '1970-01-01 00:00:00', - disconnect_time timestamp with time zone default '1970-01-01 00:00:00', - last_checkin_time timestamp with time zone default '1970-01-01 00:00:00', - data_start_time timestamp with time zone default '1970-01-01 00:00:00', - data_end_time timestamp with time zone default '1970-01-01 00:00:00', + connect_time timestamp with time zone default '1970-01-01 00:00:00+00', + disconnect_time timestamp with time zone default '1970-01-01 00:00:00+00', + last_checkin_time timestamp with time zone default '1970-01-01 00:00:00+00', + data_start_time timestamp with time zone default '1970-01-01 00:00:00+00', + data_end_time timestamp with time zone default '1970-01-01 00:00:00+00', bytes_processed bigint default 0, lines_processed bigint default 0, entries_processed bigint default 0, - CONSTRAINT PK_conninfo_id PRIMARY KEY (conninfo_id) + CONSTRAINT PK_conninfo_id PRIMARY KEY (conninfo_id) ) ; -- -------------------------------------------------------- @@ -233,9 +235,9 @@ CREATE TABLE icinga_contactnotificationmethods ( contactnotificationmethod_id bigserial, instance_id bigint default 0, contactnotification_id bigint default 0, - start_time timestamp with time zone default '1970-01-01 00:00:00', + start_time timestamp with time zone default '1970-01-01 00:00:00+00', start_time_usec INTEGER default 0, - end_time timestamp with time zone default '1970-01-01 00:00:00', + end_time timestamp with time zone default '1970-01-01 00:00:00+00', end_time_usec INTEGER default 0, command_object_id bigint default 0, command_args TEXT default '', @@ -254,9 +256,9 @@ CREATE TABLE icinga_contactnotifications ( instance_id bigint default 0, notification_id bigint default 0, contact_object_id bigint default 0, - start_time timestamp with time zone default '1970-01-01 00:00:00', + start_time timestamp with time zone default '1970-01-01 00:00:00+00', start_time_usec INTEGER default 0, - end_time timestamp with time zone default '1970-01-01 00:00:00', + end_time timestamp with time zone default '1970-01-01 00:00:00+00', end_time_usec INTEGER default 0, CONSTRAINT PK_contactnotification_id PRIMARY KEY (contactnotification_id) , CONSTRAINT UQ_contactnotifications UNIQUE (instance_id,contact_object_id,start_time,start_time_usec) @@ -306,11 +308,11 @@ CREATE TABLE icinga_contactstatus ( contactstatus_id bigserial, instance_id bigint default 0, contact_object_id bigint default 0, - status_update_time timestamp with time zone default '1970-01-01 00:00:00', + status_update_time timestamp with time zone default '1970-01-01 00:00:00+00', host_notifications_enabled INTEGER default 0, service_notifications_enabled INTEGER default 0, - last_host_notification timestamp with time zone default '1970-01-01 00:00:00', - last_service_notification timestamp with time zone default '1970-01-01 00:00:00', + last_host_notification timestamp with time zone default '1970-01-01 00:00:00+00', + last_service_notification timestamp with time zone default '1970-01-01 00:00:00+00', modified_attributes INTEGER default 0, modified_host_attributes INTEGER default 0, modified_service_attributes INTEGER default 0, @@ -366,6 +368,7 @@ CREATE TABLE icinga_customvariables ( varname TEXT default '', varvalue TEXT default '', is_json INTEGER default 0, + session_token TEXT default NULL, CONSTRAINT PK_customvariable_id PRIMARY KEY (customvariable_id) , CONSTRAINT UQ_customvariables UNIQUE (object_id,config_type,varname) ) ; @@ -381,11 +384,12 @@ CREATE TABLE icinga_customvariablestatus ( customvariablestatus_id bigserial, instance_id bigint default 0, object_id bigint default 0, - status_update_time timestamp with time zone default '1970-01-01 00:00:00', + status_update_time timestamp with time zone default '1970-01-01 00:00:00+00', has_been_modified INTEGER default 0, varname TEXT default '', varvalue TEXT default '', is_json INTEGER default 0, + session_token TEXT default NULL, CONSTRAINT PK_customvariablestatus_id PRIMARY KEY (customvariablestatus_id) , CONSTRAINT UQ_customvariablestatus UNIQUE (object_id,varname) ) ; @@ -402,8 +406,8 @@ CREATE TABLE icinga_dbversion ( dbversion_id bigserial, name TEXT default '', version TEXT default '', - create_time timestamp with time zone default '1970-01-01 00:00:00', - modify_time timestamp with time zone default '1970-01-01 00:00:00', + create_time timestamp with time zone default '1970-01-01 00:00:00+00', + modify_time timestamp with time zone default '1970-01-01 00:00:00+00', CONSTRAINT PK_dbversion_id PRIMARY KEY (dbversion_id) , CONSTRAINT UQ_dbversion UNIQUE (name) ) ; @@ -419,23 +423,24 @@ CREATE TABLE icinga_downtimehistory ( instance_id bigint default 0, downtime_type INTEGER default 0, object_id bigint default 0, - entry_time timestamp with time zone default '1970-01-01 00:00:00', + entry_time timestamp with time zone default '1970-01-01 00:00:00+00', author_name TEXT default '', comment_data TEXT default '', internal_downtime_id bigint default 0, triggered_by_id bigint default 0, is_fixed INTEGER default 0, duration BIGINT default 0, - scheduled_start_time timestamp with time zone default '1970-01-01 00:00:00', - scheduled_end_time timestamp with time zone default '1970-01-01 00:00:00', + scheduled_start_time timestamp with time zone default '1970-01-01 00:00:00+00', + scheduled_end_time timestamp with time zone default '1970-01-01 00:00:00+00', was_started INTEGER default 0, - actual_start_time timestamp with time zone default '1970-01-01 00:00:00', + actual_start_time timestamp with time zone default '1970-01-01 00:00:00+00', actual_start_time_usec INTEGER default 0, - actual_end_time timestamp with time zone default '1970-01-01 00:00:00', + actual_end_time timestamp with time zone default '1970-01-01 00:00:00+00', actual_end_time_usec INTEGER default 0, was_cancelled INTEGER default 0, is_in_effect INTEGER default 0, - trigger_time timestamp with time zone default '1970-01-01 00:00:00', + trigger_time timestamp with time zone default '1970-01-01 00:00:00+00', + unique_id TEXT default NULL, CONSTRAINT PK_downtimehistory_id PRIMARY KEY (downtimehistory_id) , CONSTRAINT UQ_downtimehistory UNIQUE (instance_id,object_id,entry_time,internal_downtime_id) ) ; @@ -453,9 +458,9 @@ CREATE TABLE icinga_eventhandlers ( object_id bigint default 0, state INTEGER default 0, state_type INTEGER default 0, - start_time timestamp with time zone default '1970-01-01 00:00:00', + start_time timestamp with time zone default '1970-01-01 00:00:00+00', start_time_usec INTEGER default 0, - end_time timestamp with time zone default '1970-01-01 00:00:00', + end_time timestamp with time zone default '1970-01-01 00:00:00+00', end_time_usec INTEGER default 0, command_object_id bigint default 0, command_args TEXT default '', @@ -479,11 +484,11 @@ CREATE TABLE icinga_eventhandlers ( CREATE TABLE icinga_externalcommands ( externalcommand_id bigserial, instance_id bigint default 0, - entry_time timestamp with time zone default '1970-01-01 00:00:00', + entry_time timestamp with time zone default '1970-01-01 00:00:00+00', command_type INTEGER default 0, command_name TEXT default '', command_args TEXT default '', - CONSTRAINT PK_externalcommand_id PRIMARY KEY (externalcommand_id) + CONSTRAINT PK_externalcommand_id PRIMARY KEY (externalcommand_id) ) ; -- -------------------------------------------------------- @@ -495,7 +500,7 @@ CREATE TABLE icinga_externalcommands ( CREATE TABLE icinga_flappinghistory ( flappinghistory_id bigserial, instance_id bigint default 0, - event_time timestamp with time zone default '1970-01-01 00:00:00', + event_time timestamp with time zone default '1970-01-01 00:00:00+00', event_time_usec INTEGER default 0, event_type INTEGER default 0, reason_type INTEGER default 0, @@ -504,9 +509,9 @@ CREATE TABLE icinga_flappinghistory ( percent_state_change double precision default 0, low_threshold double precision default 0, high_threshold double precision default 0, - comment_time timestamp with time zone default '1970-01-01 00:00:00', + comment_time timestamp with time zone default '1970-01-01 00:00:00+00', internal_comment_id bigint default 0, - CONSTRAINT PK_flappinghistory_id PRIMARY KEY (flappinghistory_id) + CONSTRAINT PK_flappinghistory_id PRIMARY KEY (flappinghistory_id) ) ; -- -------------------------------------------------------- @@ -525,9 +530,9 @@ CREATE TABLE icinga_hostchecks ( max_check_attempts INTEGER default 0, state INTEGER default 0, state_type INTEGER default 0, - start_time timestamp with time zone default '1970-01-01 00:00:00', + start_time timestamp with time zone default '1970-01-01 00:00:00+00', start_time_usec INTEGER default 0, - end_time timestamp with time zone default '1970-01-01 00:00:00', + end_time timestamp with time zone default '1970-01-01 00:00:00+00', end_time_usec INTEGER default 0, command_object_id bigint default 0, command_args TEXT default '', @@ -540,7 +545,7 @@ CREATE TABLE icinga_hostchecks ( output TEXT default '', long_output TEXT default '', perfdata TEXT default '', - CONSTRAINT PK_hostcheck_id PRIMARY KEY (hostcheck_id) + CONSTRAINT PK_hostcheck_id PRIMARY KEY (hostcheck_id) ) ; -- -------------------------------------------------------- @@ -730,7 +735,7 @@ CREATE TABLE icinga_hoststatus ( hoststatus_id bigserial, instance_id bigint default 0, host_object_id bigint default 0, - status_update_time timestamp with time zone default '1970-01-01 00:00:00', + status_update_time timestamp with time zone default '1970-01-01 00:00:00+00', output TEXT default '', long_output TEXT default '', perfdata TEXT default '', @@ -740,18 +745,18 @@ CREATE TABLE icinga_hoststatus ( should_be_scheduled INTEGER default 0, current_check_attempt INTEGER default 0, max_check_attempts INTEGER default 0, - last_check timestamp with time zone default '1970-01-01 00:00:00', - next_check timestamp with time zone default '1970-01-01 00:00:00', + last_check timestamp with time zone default '1970-01-01 00:00:00+00', + next_check timestamp with time zone default '1970-01-01 00:00:00+00', check_type INTEGER default 0, - last_state_change timestamp with time zone default '1970-01-01 00:00:00', - last_hard_state_change timestamp with time zone default '1970-01-01 00:00:00', + last_state_change timestamp with time zone default '1970-01-01 00:00:00+00', + last_hard_state_change timestamp with time zone default '1970-01-01 00:00:00+00', last_hard_state INTEGER default 0, - last_time_up timestamp with time zone default '1970-01-01 00:00:00', - last_time_down timestamp with time zone default '1970-01-01 00:00:00', - last_time_unreachable timestamp with time zone default '1970-01-01 00:00:00', + last_time_up timestamp with time zone default '1970-01-01 00:00:00+00', + last_time_down timestamp with time zone default '1970-01-01 00:00:00+00', + last_time_unreachable timestamp with time zone default '1970-01-01 00:00:00+00', state_type INTEGER default 0, - last_notification timestamp with time zone default '1970-01-01 00:00:00', - next_notification timestamp with time zone default '1970-01-01 00:00:00', + last_notification timestamp with time zone default '1970-01-01 00:00:00+00', + next_notification timestamp with time zone default '1970-01-01 00:00:00+00', no_more_notifications INTEGER default 0, notifications_enabled INTEGER default 0, problem_has_been_acknowledged INTEGER default 0, @@ -770,6 +775,7 @@ CREATE TABLE icinga_hoststatus ( process_performance_data INTEGER default 0, obsess_over_host INTEGER default 0, modified_host_attributes INTEGER default 0, + original_attributes TEXT default NULL, event_handler TEXT default '', check_command TEXT default '', normal_check_interval double precision default 0, @@ -805,7 +811,7 @@ CREATE TABLE icinga_host_contacts ( instance_id bigint default 0, host_id bigint default 0, contact_object_id bigint default 0, - CONSTRAINT PK_host_contact_id PRIMARY KEY (host_contact_id) + CONSTRAINT PK_host_contact_id PRIMARY KEY (host_contact_id) ) ; -- -------------------------------------------------------- @@ -832,7 +838,7 @@ CREATE TABLE icinga_instances ( instance_id bigserial, instance_name TEXT default '', instance_description TEXT default '', - CONSTRAINT PK_instance_id PRIMARY KEY (instance_id) + CONSTRAINT PK_instance_id PRIMARY KEY (instance_id) ) ; -- -------------------------------------------------------- @@ -844,15 +850,15 @@ CREATE TABLE icinga_instances ( CREATE TABLE icinga_logentries ( logentry_id bigserial, instance_id bigint default 0, - logentry_time timestamp with time zone default '1970-01-01 00:00:00', - entry_time timestamp with time zone default '1970-01-01 00:00:00', + logentry_time timestamp with time zone default '1970-01-01 00:00:00+00', + entry_time timestamp with time zone default '1970-01-01 00:00:00+00', entry_time_usec INTEGER default 0, logentry_type INTEGER default 0, logentry_data TEXT default '', realtime_data INTEGER default 0, inferred_data_extracted INTEGER default 0, object_id bigint default NULL, - CONSTRAINT PK_logentry_id PRIMARY KEY (logentry_id) + CONSTRAINT PK_logentry_id PRIMARY KEY (logentry_id) ) ; -- -------------------------------------------------------- @@ -867,9 +873,9 @@ CREATE TABLE icinga_notifications ( notification_type INTEGER default 0, notification_reason INTEGER default 0, object_id bigint default 0, - start_time timestamp with time zone default '1970-01-01 00:00:00', + start_time timestamp with time zone default '1970-01-01 00:00:00+00', start_time_usec INTEGER default 0, - end_time timestamp with time zone default '1970-01-01 00:00:00', + end_time timestamp with time zone default '1970-01-01 00:00:00+00', end_time_usec INTEGER default 0, state INTEGER default 0, output TEXT default '', @@ -893,7 +899,7 @@ CREATE TABLE icinga_objects ( name1 TEXT, name2 TEXT, is_active INTEGER default 0, - CONSTRAINT PK_object_id PRIMARY KEY (object_id) + CONSTRAINT PK_object_id PRIMARY KEY (object_id) -- UNIQUE (objecttype_id,name1,name2) ) ; CREATE INDEX icinga_objects_i ON icinga_objects(objecttype_id,name1,name2); @@ -908,13 +914,13 @@ CREATE TABLE icinga_processevents ( processevent_id bigserial, instance_id bigint default 0, event_type INTEGER default 0, - event_time timestamp with time zone default '1970-01-01 00:00:00', + event_time timestamp with time zone default '1970-01-01 00:00:00+00', event_time_usec INTEGER default 0, process_id bigint default 0, program_name TEXT default '', program_version TEXT default '', program_date TEXT default '', - CONSTRAINT PK_processevent_id PRIMARY KEY (processevent_id) + CONSTRAINT PK_processevent_id PRIMARY KEY (processevent_id) ) ; -- -------------------------------------------------------- @@ -927,17 +933,17 @@ CREATE TABLE icinga_programstatus ( programstatus_id bigserial, instance_id bigint default 0, program_version TEXT default NULL, - status_update_time timestamp with time zone default '1970-01-01 00:00:00', - program_start_time timestamp with time zone default '1970-01-01 00:00:00', - program_end_time timestamp with time zone default '1970-01-01 00:00:00', + status_update_time timestamp with time zone default '1970-01-01 00:00:00+00', + program_start_time timestamp with time zone default '1970-01-01 00:00:00+00', + program_end_time timestamp with time zone default '1970-01-01 00:00:00+00', is_currently_running INTEGER default 0, endpoint_name TEXT default '', process_id bigint default 0, daemon_mode INTEGER default 0, - last_command_check timestamp with time zone default '1970-01-01 00:00:00', - last_log_rotation timestamp with time zone default '1970-01-01 00:00:00', + last_command_check timestamp with time zone default '1970-01-01 00:00:00+00', + last_log_rotation timestamp with time zone default '1970-01-01 00:00:00+00', notifications_enabled INTEGER default 0, - disable_notif_expire_time timestamp with time zone default '1970-01-01 00:00:00', + disable_notif_expire_time timestamp with time zone default '1970-01-01 00:00:00+00', active_service_checks_enabled INTEGER default 0, passive_service_checks_enabled INTEGER default 0, active_host_checks_enabled INTEGER default 0, @@ -982,20 +988,21 @@ CREATE TABLE icinga_scheduleddowntime ( instance_id bigint default 0, downtime_type INTEGER default 0, object_id bigint default 0, - entry_time timestamp with time zone default '1970-01-01 00:00:00', + entry_time timestamp with time zone default '1970-01-01 00:00:00+00', author_name TEXT default '', comment_data TEXT default '', internal_downtime_id bigint default 0, triggered_by_id bigint default 0, is_fixed INTEGER default 0, duration BIGINT default 0, - scheduled_start_time timestamp with time zone default '1970-01-01 00:00:00', - scheduled_end_time timestamp with time zone default '1970-01-01 00:00:00', + scheduled_start_time timestamp with time zone default '1970-01-01 00:00:00+00', + scheduled_end_time timestamp with time zone default '1970-01-01 00:00:00+00', was_started INTEGER default 0, - actual_start_time timestamp with time zone default '1970-01-01 00:00:00', + actual_start_time timestamp with time zone default '1970-01-01 00:00:00+00', actual_start_time_usec INTEGER default 0, is_in_effect INTEGER default 0, - trigger_time timestamp with time zone default '1970-01-01 00:00:00', + trigger_time timestamp with time zone default '1970-01-01 00:00:00+00', + unique_id TEXT default NULL, CONSTRAINT PK_scheduleddowntime_id PRIMARY KEY (scheduleddowntime_id) , CONSTRAINT UQ_scheduleddowntime UNIQUE (instance_id,object_id,entry_time,internal_downtime_id) ) ; @@ -1015,9 +1022,9 @@ CREATE TABLE icinga_servicechecks ( max_check_attempts INTEGER default 0, state INTEGER default 0, state_type INTEGER default 0, - start_time timestamp with time zone default '1970-01-01 00:00:00', + start_time timestamp with time zone default '1970-01-01 00:00:00+00', start_time_usec INTEGER default 0, - end_time timestamp with time zone default '1970-01-01 00:00:00', + end_time timestamp with time zone default '1970-01-01 00:00:00+00', end_time_usec INTEGER default 0, command_object_id bigint default 0, command_args TEXT default '', @@ -1030,7 +1037,7 @@ CREATE TABLE icinga_servicechecks ( output TEXT default '', long_output TEXT default '', perfdata TEXT default '', - CONSTRAINT PK_servicecheck_id PRIMARY KEY (servicecheck_id) + CONSTRAINT PK_servicecheck_id PRIMARY KEY (servicecheck_id) ) ; -- -------------------------------------------------------- @@ -1215,7 +1222,7 @@ CREATE TABLE icinga_servicestatus ( servicestatus_id bigserial, instance_id bigint default 0, service_object_id bigint default 0, - status_update_time timestamp with time zone default '1970-01-01 00:00:00', + status_update_time timestamp with time zone default '1970-01-01 00:00:00+00', output TEXT default '', long_output TEXT default '', perfdata TEXT default '', @@ -1225,19 +1232,19 @@ CREATE TABLE icinga_servicestatus ( should_be_scheduled INTEGER default 0, current_check_attempt INTEGER default 0, max_check_attempts INTEGER default 0, - last_check timestamp with time zone default '1970-01-01 00:00:00', - next_check timestamp with time zone default '1970-01-01 00:00:00', + last_check timestamp with time zone default '1970-01-01 00:00:00+00', + next_check timestamp with time zone default '1970-01-01 00:00:00+00', check_type INTEGER default 0, - last_state_change timestamp with time zone default '1970-01-01 00:00:00', - last_hard_state_change timestamp with time zone default '1970-01-01 00:00:00', + last_state_change timestamp with time zone default '1970-01-01 00:00:00+00', + last_hard_state_change timestamp with time zone default '1970-01-01 00:00:00+00', last_hard_state INTEGER default 0, - last_time_ok timestamp with time zone default '1970-01-01 00:00:00', - last_time_warning timestamp with time zone default '1970-01-01 00:00:00', - last_time_unknown timestamp with time zone default '1970-01-01 00:00:00', - last_time_critical timestamp with time zone default '1970-01-01 00:00:00', + last_time_ok timestamp with time zone default '1970-01-01 00:00:00+00', + last_time_warning timestamp with time zone default '1970-01-01 00:00:00+00', + last_time_unknown timestamp with time zone default '1970-01-01 00:00:00+00', + last_time_critical timestamp with time zone default '1970-01-01 00:00:00+00', state_type INTEGER default 0, - last_notification timestamp with time zone default '1970-01-01 00:00:00', - next_notification timestamp with time zone default '1970-01-01 00:00:00', + last_notification timestamp with time zone default '1970-01-01 00:00:00+00', + next_notification timestamp with time zone default '1970-01-01 00:00:00+00', no_more_notifications INTEGER default 0, notifications_enabled INTEGER default 0, problem_has_been_acknowledged INTEGER default 0, @@ -1256,6 +1263,7 @@ CREATE TABLE icinga_servicestatus ( process_performance_data INTEGER default 0, obsess_over_service INTEGER default 0, modified_service_attributes INTEGER default 0, + original_attributes TEXT default NULL, event_handler TEXT default '', check_command TEXT default '', normal_check_interval double precision default 0, @@ -1291,7 +1299,7 @@ CREATE TABLE icinga_service_contacts ( instance_id bigint default 0, service_id bigint default 0, contact_object_id bigint default 0, - CONSTRAINT PK_service_contact_id PRIMARY KEY (service_contact_id) + CONSTRAINT PK_service_contact_id PRIMARY KEY (service_contact_id) ) ; -- -------------------------------------------------------- @@ -1303,7 +1311,7 @@ CREATE TABLE icinga_service_contacts ( CREATE TABLE icinga_statehistory ( statehistory_id bigserial, instance_id bigint default 0, - state_time timestamp with time zone default '1970-01-01 00:00:00', + state_time timestamp with time zone default '1970-01-01 00:00:00+00', state_time_usec INTEGER default 0, object_id bigint default 0, state_change INTEGER default 0, @@ -1315,8 +1323,8 @@ CREATE TABLE icinga_statehistory ( last_hard_state INTEGER default '-1', output TEXT default '', long_output TEXT default '', - check_source varchar(255) default NULL, - CONSTRAINT PK_statehistory_id PRIMARY KEY (statehistory_id) + check_source TEXT default '', + CONSTRAINT PK_statehistory_id PRIMARY KEY (statehistory_id) ) ; -- -------------------------------------------------------- @@ -1328,9 +1336,9 @@ CREATE TABLE icinga_statehistory ( CREATE TABLE icinga_systemcommands ( systemcommand_id bigserial, instance_id bigint default 0, - start_time timestamp with time zone default '1970-01-01 00:00:00', + start_time timestamp with time zone default '1970-01-01 00:00:00+00', start_time_usec INTEGER default 0, - end_time timestamp with time zone default '1970-01-01 00:00:00', + end_time timestamp with time zone default '1970-01-01 00:00:00+00', end_time_usec INTEGER default 0, command_line TEXT default '', timeout INTEGER default 0, @@ -1388,6 +1396,7 @@ CREATE TABLE icinga_endpoints ( endpoint_id bigserial, instance_id bigint default 0, endpoint_object_id bigint default 0, + zone_object_id bigint default 0, config_type integer default 0, identity text DEFAULT NULL, node text DEFAULT NULL, @@ -1405,7 +1414,8 @@ CREATE TABLE icinga_endpointstatus ( endpointstatus_id bigserial, instance_id bigint default 0, endpoint_object_id bigint default 0, - status_update_time timestamp with time zone default '1970-01-01 00:00:00', + zone_object_id bigint default 0, + status_update_time timestamp with time zone default '1970-01-01 00:00:00+00', identity text DEFAULT NULL, node text DEFAULT NULL, is_connected integer default 0, @@ -1413,6 +1423,37 @@ CREATE TABLE icinga_endpointstatus ( CONSTRAINT UQ_endpointstatus UNIQUE (endpoint_object_id) ) ; +-- +-- Table structure for table icinga_zones +-- + +CREATE TABLE icinga_zones ( + zone_id bigserial, + instance_id bigint default 0, + zone_object_id bigint default 0, + parent_zone_object_id bigint default 0, + config_type integer default 0, + is_global integer default 0, + CONSTRAINT PK_zone_id PRIMARY KEY (zone_id) , + CONSTRAINT UQ_zones UNIQUE (instance_id,config_type,zone_object_id) +) ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table icinga_zonestatus +-- + +CREATE TABLE icinga_zonestatus ( + zonestatus_id bigserial, + instance_id bigint default 0, + zone_object_id bigint default 0, + parent_zone_object_id bigint default 0, + status_update_time timestamp with time zone default '1970-01-01 00:00:00+00', + CONSTRAINT PK_zonestatus_id PRIMARY KEY (zonestatus_id) , + CONSTRAINT UQ_zonestatus UNIQUE (zone_object_id) +) ; + ALTER TABLE icinga_servicestatus ADD COLUMN endpoint_object_id bigint default NULL; ALTER TABLE icinga_hoststatus ADD COLUMN endpoint_object_id bigint default NULL; @@ -1603,7 +1644,7 @@ CREATE INDEX notification_object_id_idx ON icinga_notifications(object_id); CREATE INDEX contact_notification_idx ON icinga_contactnotifications(notification_id, contact_object_id); CREATE INDEX contacts_object_id_idx ON icinga_contacts(contact_object_id); CREATE INDEX contact_notif_meth_notif_idx ON icinga_contactnotificationmethods(contactnotification_id, command_object_id); -CREATE INDEX command_object_idx ON icinga_commands(object_id); +CREATE INDEX command_object_idx ON icinga_commands(object_id); CREATE INDEX services_combined_object_idx ON icinga_services(service_object_id, host_object_id); -- statehistory @@ -1629,9 +1670,13 @@ CREATE INDEX sla_idx_obj ON icinga_objects (objecttype_id, is_active, name1); -- #4985 CREATE INDEX commenthistory_delete_idx ON icinga_commenthistory (instance_id, comment_time, internal_comment_id); +-- #10436 +CREATE INDEX cv_session_del_idx ON icinga_customvariables (session_token); +CREATE INDEX cvs_session_del_idx ON icinga_customvariablestatus (session_token); + -- ----------------------------------------- -- set dbversion -- ----------------------------------------- -SELECT updatedbversion('1.13.0'); +SELECT updatedbversion('1.14.0'); diff --git a/module/idoutils/db/pgsql/upgrade/pgsql-upgrade-1.14.0.sql b/module/idoutils/db/pgsql/upgrade/pgsql-upgrade-1.14.0.sql new file mode 100644 index 000000000..909869a50 --- /dev/null +++ b/module/idoutils/db/pgsql/upgrade/pgsql-upgrade-1.14.0.sql @@ -0,0 +1,185 @@ +-- ----------------------------------------- +-- upgrade path for Icinga 2.4.0 +-- +-- ----------------------------------------- +-- Copyright (c) 2015 Icinga Development Team (http://www.icinga.org) +-- +-- Please check http://docs.icinga.org for upgrading information! +-- ----------------------------------------- + +-- ----------------------------------------- +-- #9027 Default timestamps lack time zone +-- ----------------------------------------- + +ALTER TABLE icinga_acknowledgements ALTER COLUMN entry_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_acknowledgements ALTER COLUMN end_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_commenthistory ALTER COLUMN entry_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_commenthistory ALTER COLUMN comment_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_commenthistory ALTER COLUMN expiration_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_commenthistory ALTER COLUMN deletion_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_comments ALTER COLUMN entry_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_comments ALTER COLUMN comment_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_comments ALTER COLUMN expiration_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_conninfo ALTER COLUMN connect_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_conninfo ALTER COLUMN disconnect_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_conninfo ALTER COLUMN last_checkin_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_conninfo ALTER COLUMN data_start_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_conninfo ALTER COLUMN data_end_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_contactnotificationmethods ALTER COLUMN start_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_contactnotificationmethods ALTER COLUMN end_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_contactnotifications ALTER COLUMN start_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_contactnotifications ALTER COLUMN end_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_contactstatus ALTER COLUMN status_update_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_contactstatus ALTER COLUMN last_host_notification SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_contactstatus ALTER COLUMN last_service_notification SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_customvariablestatus ALTER COLUMN status_update_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_dbversion ALTER COLUMN create_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_dbversion ALTER COLUMN modify_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_downtimehistory ALTER COLUMN entry_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_downtimehistory ALTER COLUMN scheduled_start_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_downtimehistory ALTER COLUMN scheduled_end_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_downtimehistory ALTER COLUMN actual_start_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_downtimehistory ALTER COLUMN actual_end_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_downtimehistory ALTER COLUMN trigger_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_eventhandlers ALTER COLUMN start_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_eventhandlers ALTER COLUMN end_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_externalcommands ALTER COLUMN entry_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_flappinghistory ALTER COLUMN event_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_flappinghistory ALTER COLUMN comment_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_hostchecks ALTER COLUMN start_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_hostchecks ALTER COLUMN end_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_hoststatus ALTER COLUMN status_update_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_hoststatus ALTER COLUMN last_check SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_hoststatus ALTER COLUMN next_check SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_hoststatus ALTER COLUMN last_state_change SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_hoststatus ALTER COLUMN last_hard_state_change SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_hoststatus ALTER COLUMN last_time_up SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_hoststatus ALTER COLUMN last_time_down SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_hoststatus ALTER COLUMN last_time_unreachable SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_hoststatus ALTER COLUMN last_notification SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_hoststatus ALTER COLUMN next_notification SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_logentries ALTER COLUMN logentry_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_logentries ALTER COLUMN entry_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_notifications ALTER COLUMN start_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_notifications ALTER COLUMN end_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_processevents ALTER COLUMN event_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_programstatus ALTER COLUMN status_update_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_programstatus ALTER COLUMN program_start_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_programstatus ALTER COLUMN program_end_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_programstatus ALTER COLUMN last_command_check SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_programstatus ALTER COLUMN last_log_rotation SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_programstatus ALTER COLUMN disable_notif_expire_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_scheduleddowntime ALTER COLUMN entry_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_scheduleddowntime ALTER COLUMN scheduled_start_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_scheduleddowntime ALTER COLUMN scheduled_end_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_scheduleddowntime ALTER COLUMN actual_start_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_scheduleddowntime ALTER COLUMN trigger_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_servicechecks ALTER COLUMN start_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_servicechecks ALTER COLUMN end_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_servicestatus ALTER COLUMN status_update_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_servicestatus ALTER COLUMN last_check SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_servicestatus ALTER COLUMN next_check SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_servicestatus ALTER COLUMN last_state_change SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_servicestatus ALTER COLUMN last_hard_state_change SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_servicestatus ALTER COLUMN last_time_ok SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_servicestatus ALTER COLUMN last_time_warning SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_servicestatus ALTER COLUMN last_time_unknown SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_servicestatus ALTER COLUMN last_time_critical SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_servicestatus ALTER COLUMN last_notification SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_servicestatus ALTER COLUMN next_notification SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_statehistory ALTER COLUMN state_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_systemcommands ALTER COLUMN start_time SET DEFAULT '1970-01-01 00:00:00+00'; +ALTER TABLE icinga_systemcommands ALTER COLUMN end_time SET DEFAULT '1970-01-01 00:00:00+00'; + +ALTER TABLE icinga_endpointstatus ALTER COLUMN status_update_time SET DEFAULT '1970-01-01 00:00:00+00'; + +-- ----------------------------------------- +-- #9455 check_source data type +-- ----------------------------------------- + +ALTER TABLE icinga_statehistory ALTER COLUMN check_source TYPE TEXT; +ALTER TABLE icinga_statehistory ALTER COLUMN check_source SET default ''; + +-- ----------------------------------------- +-- #9286 zones table +-- ----------------------------------------- + +ALTER TABLE icinga_endpoints ADD COLUMN zone_object_id bigint default 0; +ALTER TABLE icinga_endpointstatus ADD COLUMN zone_object_id bigint default 0; + +CREATE TABLE icinga_zones ( + zone_id bigserial, + instance_id bigint default 0, + zone_object_id bigint default 0, + parent_zone_object_id bigint default 0, + config_type integer default 0, + is_global integer default 0, + CONSTRAINT PK_zone_id PRIMARY KEY (zone_id) , + CONSTRAINT UQ_zones UNIQUE (instance_id,config_type,zone_object_id) +) ; + +CREATE TABLE icinga_zonestatus ( + zonestatus_id bigserial, + instance_id bigint default 0, + zone_object_id bigint default 0, + parent_zone_object_id bigint default 0, + status_update_time timestamp with time zone default '1970-01-01 00:00:00+00', + CONSTRAINT PK_zonestatus_id PRIMARY KEY (zonestatus_id) , + CONSTRAINT UQ_zonestatus UNIQUE (zone_object_id) +) ; + +-- ----------------------------------------- +-- #10392 original attributes +-- ----------------------------------------- + +ALTER TABLE icinga_servicestatus ADD COLUMN original_attributes TEXT default NULL; +ALTER TABLE icinga_hoststatus ADD COLUMN original_attributes TEXT default NULL; + +-- ----------------------------------------- +-- #10436 deleted custom vars +-- ----------------------------------------- + +ALTER TABLE icinga_customvariables ADD COLUMN session_token TEXT default NULL; +ALTER TABLE icinga_customvariablestatus ADD COLUMN session_token TEXT default NULL; + +CREATE INDEX cv_session_del_idx ON icinga_customvariables (session_token); +CREATE INDEX cvs_session_del_idx ON icinga_customvariablestatus (session_token); + +-- ----------------------------------------- +-- #10431 comment/downtime unique id +-- ----------------------------------------- + +ALTER TABLE icinga_comments ADD COLUMN unique_id TEXT default NULL; +ALTER TABLE icinga_commenthistory ADD COLUMN unique_id TEXT default NULL; + +ALTER TABLE icinga_scheduleddowntime ADD COLUMN unique_id TEXT default NULL; +ALTER TABLE icinga_downtimehistory ADD COLUMN unique_id TEXT default NULL; + +-- ----------------------------------------- +-- update dbversion +-- ----------------------------------------- + +SELECT updatedbversion('1.14.0'); diff --git a/module/idoutils/db/scripts/installdb.in b/module/idoutils/db/scripts/installdb.in index 78608b6c2..ad7a5a421 100755 --- a/module/idoutils/db/scripts/installdb.in +++ b/module/idoutils/db/scripts/installdb.in @@ -45,7 +45,7 @@ my $dbh = DBI->connect("DBI:mysql:database=$database;host=$hostname", or die "Cannot connect to database"; # Current database version -my $thisversion="1.13.0"; +my $thisversion="1.14.0"; # Create version table if it doesn't exist eval { $dbh->do("SELECT * FROM icinga_dbversion LIMIT 1") }; diff --git a/module/idoutils/include/common.h b/module/idoutils/include/common.h index 1abe12095..f2332625e 100644 --- a/module/idoutils/include/common.h +++ b/module/idoutils/include/common.h @@ -25,7 +25,7 @@ #define IDO_DATE "07-15-2015" #define IDO_VERSION "1.13.3" -#define IDO_SCHEMA_VERSION "1.13.0" +#define IDO_SCHEMA_VERSION "1.14.0" #define IDO_COPYRIGHT "Copyright(c) 2005-2008 Ethan Galstad, Copyright(c) 2009-2015 Icinga Development Team (https://www.icinga.org)" #define IDO_LICENSE "License: GPL v2" diff --git a/update-version-schema b/update-version-schema index f72156592..a76c56f3b 100755 --- a/update-version-schema +++ b/update-version-schema @@ -10,10 +10,10 @@ else fi # Current version number -CURRENTVERSION=1.13.0 +CURRENTVERSION=1.14.0 # Last date -LASTDATE=03-13-2015 +LASTDATE=10-30-2015 if [ "x$1" = "x" ] then