From 9d82b47b19271f39e6ec671d801766c15bab025d Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 1 Oct 2019 17:30:36 +0200 Subject: [PATCH 1/7] Schema: add host history details tables as in the IDO --- etc/schema/mysql/host.sql | 91 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/etc/schema/mysql/host.sql b/etc/schema/mysql/host.sql index 4f158ca9..bda17c44 100644 --- a/etc/schema/mysql/host.sql +++ b/etc/schema/mysql/host.sql @@ -145,3 +145,94 @@ CREATE TABLE host_state ( PRIMARY KEY (host_id) ) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; + +CREATE TABLE host_notification_history ( + id binary(16) NOT NULL COMMENT 'UUID', + environment_id binary(20) NOT NULL COMMENT 'environment.id', + host_id binary(20) NOT NULL COMMENT 'host.id', + notification_id binary(20) NOT NULL COMMENT 'notification.id', + + type smallint(3) unsigned NOT NULL, + send_time bigint(20) unsigned NOT NULL, + state tinyint(1) unsigned NOT NULL, + output text DEFAULT NULL, + long_output text DEFAULT NULL, + users_notified smallint(5) unsigned NOT NULL, + + PRIMARY KEY (id) +) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; + +CREATE TABLE host_state_history ( + id binary(16) NOT NULL COMMENT 'UUID', + environment_id binary(20) NOT NULL COMMENT 'environment.id', + host_id binary(20) NOT NULL COMMENT 'host.id', + + change_time bigint(20) unsigned NOT NULL, + state_type enum('hard', 'soft') NOT NULL, + soft_state tinyint(1) unsigned NOT NULL, + hard_state tinyint(1) unsigned NOT NULL, + attempt tinyint(1) unsigned NOT NULL, + last_soft_state tinyint(1) unsigned NOT NULL, + last_hard_state tinyint(1) unsigned NOT NULL, + output text DEFAULT NULL, + long_output text DEFAULT NULL, + max_check_attempts int(10) unsigned NOT NULL, + + PRIMARY KEY (id) +) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; + +CREATE TABLE host_downtime_history ( + id binary(16) NOT NULL COMMENT 'UUID', + environment_id binary(20) NOT NULL COMMENT 'environment.id', + host_id binary(20) NOT NULL COMMENT 'host.id', + downtime_id binary(20) NOT NULL COMMENT 'host_downtime.id', + triggered_by_id binary(20) NOT NULL COMMENT 'host_downtime.id', + + entry_time bigint(20) unsigned NOT NULL, + author varchar(255) NOT NULL COLLATE utf8mb4_unicode_ci, + comment text NOT NULL, + is_fixed enum('y', 'n') NOT NULL, + duration bigint(20) unsigned NOT NULL, + scheduled_start_time bigint(20) unsigned NOT NULL, + scheduled_end_time bigint(20) unsigned NOT NULL, + was_started enum('y', 'n') NOT NULL, + actual_start_time bigint(20) unsigned DEFAULT NULL COMMENT 'Time when the host went into a problem state during the downtimes timeframe', + actual_end_time bigint(20) unsigned DEFAULT NULL COMMENT 'Problem state assumed: scheduled_end_time if fixed, start_time + duration otherwise', + was_cancelled enum('y', 'n') NOT NULL, + is_in_effect enum('y', 'n') NOT NULL, + trigger_time bigint(20) unsigned NOT NULL, + deletion_time bigint(20) unsigned NOT NULL, + + PRIMARY KEY (id) +) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; + +CREATE TABLE host_comment_history ( + id binary(16) NOT NULL COMMENT 'UUID', + environment_id binary(20) NOT NULL COMMENT 'environment.id', + host_id binary(20) NOT NULL COMMENT 'host.id', + comment_id binary(20) NOT NULL COMMENT 'host_comment.id', + + entry_time bigint(20) unsigned NOT NULL, + author varchar(255) NOT NULL COLLATE utf8mb4_unicode_ci, + comment text NOT NULL, + entry_type enum('comment','ack','downtime','flapping') NOT NULL, + is_persistent enum('y','n') NOT NULL, + expire_time bigint(20) unsigned DEFAULT NULL, + deletion_time bigint(20) unsigned NOT NULL, + + PRIMARY KEY (id) +) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; + +CREATE TABLE host_flapping_history ( + id binary(16) NOT NULL COMMENT 'UUID', + environment_id binary(20) NOT NULL COMMENT 'environment.id', + host_id binary(20) NOT NULL COMMENT 'host.id', + + event_time bigint(20) unsigned NOT NULL, + event_type enum('start', 'end') NOT NULL, + percent_state_change float unsigned NOT NULL, + flapping_threshold_low float unsigned NOT NULL, + flapping_threshold_high float unsigned NOT NULL, + + PRIMARY KEY (id) +) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; From 4d272f67291b5d775525443a4acfb31eaf3772b8 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 1 Oct 2019 18:12:12 +0200 Subject: [PATCH 2/7] Schema: let each row of some host history details tables represent an ongoing state --- etc/schema/mysql/host.sql | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/etc/schema/mysql/host.sql b/etc/schema/mysql/host.sql index bda17c44..bebc1503 100644 --- a/etc/schema/mysql/host.sql +++ b/etc/schema/mysql/host.sql @@ -201,9 +201,10 @@ CREATE TABLE host_downtime_history ( was_cancelled enum('y', 'n') NOT NULL, is_in_effect enum('y', 'n') NOT NULL, trigger_time bigint(20) unsigned NOT NULL, - deletion_time bigint(20) unsigned NOT NULL, + deletion_time bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '0 = not deleted yet', - PRIMARY KEY (id) + PRIMARY KEY (id), + UNIQUE INDEX idx_downtime_id (downtime_id) ) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; CREATE TABLE host_comment_history ( @@ -218,9 +219,10 @@ CREATE TABLE host_comment_history ( entry_type enum('comment','ack','downtime','flapping') NOT NULL, is_persistent enum('y','n') NOT NULL, expire_time bigint(20) unsigned DEFAULT NULL, - deletion_time bigint(20) unsigned NOT NULL, + deletion_time bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '0 = not deleted yet', - PRIMARY KEY (id) + PRIMARY KEY (id), + UNIQUE INDEX idx_comment_id (comment_id) ) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; CREATE TABLE host_flapping_history ( @@ -228,11 +230,19 @@ CREATE TABLE host_flapping_history ( environment_id binary(20) NOT NULL COMMENT 'environment.id', host_id binary(20) NOT NULL COMMENT 'host.id', - event_time bigint(20) unsigned NOT NULL, - event_type enum('start', 'end') NOT NULL, + start_time bigint(20) unsigned NOT NULL, + end_time bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '0 = not ended yet', percent_state_change float unsigned NOT NULL, flapping_threshold_low float unsigned NOT NULL, flapping_threshold_high float unsigned NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; + +CREATE TABLE host_flapping_current ( + host_id binary(20) NOT NULL COMMENT 'host.id', + flapping_history_id binary(16) NOT NULL COMMENT 'host_flapping_history.id', + environment_id binary(20) NOT NULL COMMENT 'environment.id', + + PRIMARY KEY (host_id) +) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; From 36219615bbbd0af2c647908c5ab4029813776d19 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 2 Oct 2019 10:25:54 +0200 Subject: [PATCH 3/7] Schema: change the primary keys of some host history details tables --- etc/schema/mysql/host.sql | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/etc/schema/mysql/host.sql b/etc/schema/mysql/host.sql index bebc1503..ef547514 100644 --- a/etc/schema/mysql/host.sql +++ b/etc/schema/mysql/host.sql @@ -182,10 +182,9 @@ CREATE TABLE host_state_history ( ) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; CREATE TABLE host_downtime_history ( - id binary(16) NOT NULL COMMENT 'UUID', + downtime_id binary(20) NOT NULL COMMENT 'host_downtime.id', environment_id binary(20) NOT NULL COMMENT 'environment.id', host_id binary(20) NOT NULL COMMENT 'host.id', - downtime_id binary(20) NOT NULL COMMENT 'host_downtime.id', triggered_by_id binary(20) NOT NULL COMMENT 'host_downtime.id', entry_time bigint(20) unsigned NOT NULL, @@ -203,15 +202,13 @@ CREATE TABLE host_downtime_history ( trigger_time bigint(20) unsigned NOT NULL, deletion_time bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '0 = not deleted yet', - PRIMARY KEY (id), - UNIQUE INDEX idx_downtime_id (downtime_id) + PRIMARY KEY (downtime_id) ) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; CREATE TABLE host_comment_history ( - id binary(16) NOT NULL COMMENT 'UUID', + comment_id binary(20) NOT NULL COMMENT 'host_comment.id', environment_id binary(20) NOT NULL COMMENT 'environment.id', host_id binary(20) NOT NULL COMMENT 'host.id', - comment_id binary(20) NOT NULL COMMENT 'host_comment.id', entry_time bigint(20) unsigned NOT NULL, author varchar(255) NOT NULL COLLATE utf8mb4_unicode_ci, @@ -221,8 +218,7 @@ CREATE TABLE host_comment_history ( expire_time bigint(20) unsigned DEFAULT NULL, deletion_time bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '0 = not deleted yet', - PRIMARY KEY (id), - UNIQUE INDEX idx_comment_id (comment_id) + PRIMARY KEY (comment_id) ) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; CREATE TABLE host_flapping_history ( From 0f25474b5ab55490452c85ffa2febb0858165b4e Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 2 Oct 2019 10:30:46 +0200 Subject: [PATCH 4/7] Schema: add host history list tables --- etc/schema/mysql/host.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/etc/schema/mysql/host.sql b/etc/schema/mysql/host.sql index ef547514..053653f9 100644 --- a/etc/schema/mysql/host.sql +++ b/etc/schema/mysql/host.sql @@ -242,3 +242,19 @@ CREATE TABLE host_flapping_current ( PRIMARY KEY (host_id) ) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; + +CREATE TABLE host_history ( + id binary(16) NOT NULL COMMENT 'notification_history_id, state_history_id, flapping_history_id or UUID', + environment_id binary(20) NOT NULL COMMENT 'environment.id', + host_id binary(20) NOT NULL COMMENT 'host.id', + notification_history_id binary(16) NOT NULL COMMENT 'host_notification_history.id or 00000000-0000-0000-0000-000000000000', + state_history_id binary(16) NOT NULL COMMENT 'host_state_history.id or 00000000-0000-0000-0000-000000000000', + downtime_history_id binary(20) NOT NULL COMMENT 'host_downtime_history.downtime_id or 0000000000000000000000000000000000000000', + comment_history_id binary(20) NOT NULL COMMENT 'host_comment_history.comment_id or 0000000000000000000000000000000000000000', + flapping_history_id binary(16) NOT NULL COMMENT 'host_flapping_history.id or 00000000-0000-0000-0000-000000000000', + + event_type enum('notification','state','downtime','comment','flapping') NOT NULL, + event_time bigint(20) unsigned NOT NULL, + + PRIMARY KEY (id) +) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; From 4f36cb3ae4a59d2b79e313362119575b13e9b64e Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 2 Oct 2019 10:38:04 +0200 Subject: [PATCH 5/7] Schema: add service history tables --- etc/schema/mysql/service.sql | 113 +++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/etc/schema/mysql/service.sql b/etc/schema/mysql/service.sql index 83ab763a..b3847758 100644 --- a/etc/schema/mysql/service.sql +++ b/etc/schema/mysql/service.sql @@ -138,3 +138,116 @@ CREATE TABLE service_state ( PRIMARY KEY (service_id) ) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; + +CREATE TABLE service_notification_history ( + id binary(16) NOT NULL COMMENT 'UUID', + environment_id binary(20) NOT NULL COMMENT 'environment.id', + service_id binary(20) NOT NULL COMMENT 'service.id', + notification_id binary(20) NOT NULL COMMENT 'notification.id', + + type smallint(3) unsigned NOT NULL, + send_time bigint(20) unsigned NOT NULL, + state tinyint(1) unsigned NOT NULL, + output text DEFAULT NULL, + long_output text DEFAULT NULL, + users_notified smallint(5) unsigned NOT NULL, + + PRIMARY KEY (id) +) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; + +CREATE TABLE service_state_history ( + id binary(16) NOT NULL COMMENT 'UUID', + environment_id binary(20) NOT NULL COMMENT 'environment.id', + service_id binary(20) NOT NULL COMMENT 'service.id', + + change_time bigint(20) unsigned NOT NULL, + state_type enum('hard', 'soft') NOT NULL, + soft_state tinyint(1) unsigned NOT NULL, + hard_state tinyint(1) unsigned NOT NULL, + attempt tinyint(1) unsigned NOT NULL, + last_soft_state tinyint(1) unsigned NOT NULL, + last_hard_state tinyint(1) unsigned NOT NULL, + output text DEFAULT NULL, + long_output text DEFAULT NULL, + max_check_attempts int(10) unsigned NOT NULL, + + PRIMARY KEY (id) +) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; + +CREATE TABLE service_downtime_history ( + downtime_id binary(20) NOT NULL COMMENT 'service_downtime.id', + environment_id binary(20) NOT NULL COMMENT 'environment.id', + service_id binary(20) NOT NULL COMMENT 'service.id', + triggered_by_id binary(20) NOT NULL COMMENT 'service_downtime.id', + + entry_time bigint(20) unsigned NOT NULL, + author varchar(255) NOT NULL COLLATE utf8mb4_unicode_ci, + comment text NOT NULL, + is_fixed enum('y', 'n') NOT NULL, + duration bigint(20) unsigned NOT NULL, + scheduled_start_time bigint(20) unsigned NOT NULL, + scheduled_end_time bigint(20) unsigned NOT NULL, + was_started enum('y', 'n') NOT NULL, + actual_start_time bigint(20) unsigned DEFAULT NULL COMMENT 'Time when the service went into a problem state during the downtimes timeframe', + actual_end_time bigint(20) unsigned DEFAULT NULL COMMENT 'Problem state assumed: scheduled_end_time if fixed, start_time + duration otherwise', + was_cancelled enum('y', 'n') NOT NULL, + is_in_effect enum('y', 'n') NOT NULL, + trigger_time bigint(20) unsigned NOT NULL, + deletion_time bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '0 = not deleted yet', + + PRIMARY KEY (downtime_id) +) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; + +CREATE TABLE service_comment_history ( + comment_id binary(20) NOT NULL COMMENT 'service_comment.id', + environment_id binary(20) NOT NULL COMMENT 'environment.id', + service_id binary(20) NOT NULL COMMENT 'service.id', + + entry_time bigint(20) unsigned NOT NULL, + author varchar(255) NOT NULL COLLATE utf8mb4_unicode_ci, + comment text NOT NULL, + entry_type enum('comment','ack','downtime','flapping') NOT NULL, + is_persistent enum('y','n') NOT NULL, + expire_time bigint(20) unsigned DEFAULT NULL, + deletion_time bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '0 = not deleted yet', + + PRIMARY KEY (comment_id) +) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; + +CREATE TABLE service_flapping_history ( + id binary(16) NOT NULL COMMENT 'UUID', + environment_id binary(20) NOT NULL COMMENT 'environment.id', + service_id binary(20) NOT NULL COMMENT 'service.id', + + start_time bigint(20) unsigned NOT NULL, + end_time bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '0 = not ended yet', + percent_state_change float unsigned NOT NULL, + flapping_threshold_low float unsigned NOT NULL, + flapping_threshold_high float unsigned NOT NULL, + + PRIMARY KEY (id) +) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; + +CREATE TABLE service_flapping_current ( + service_id binary(20) NOT NULL COMMENT 'service.id', + flapping_history_id binary(16) NOT NULL COMMENT 'service_flapping_history.id', + environment_id binary(20) NOT NULL COMMENT 'environment.id', + + PRIMARY KEY (service_id) +) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; + +CREATE TABLE service_history ( + id binary(16) NOT NULL COMMENT 'notification_history_id, state_history_id, flapping_history_id or UUID', + environment_id binary(20) NOT NULL COMMENT 'environment.id', + service_id binary(20) NOT NULL COMMENT 'service.id', + notification_history_id binary(16) NOT NULL COMMENT 'service_notification_history.id or 00000000-0000-0000-0000-000000000000', + state_history_id binary(16) NOT NULL COMMENT 'service_state_history.id or 00000000-0000-0000-0000-000000000000', + downtime_history_id binary(20) NOT NULL COMMENT 'service_downtime_history.downtime_id or 0000000000000000000000000000000000000000', + comment_history_id binary(20) NOT NULL COMMENT 'service_comment_history.comment_id or 0000000000000000000000000000000000000000', + flapping_history_id binary(16) NOT NULL COMMENT 'service_flapping_history.id or 00000000-0000-0000-0000-000000000000', + + event_type enum('notification','state','downtime','comment','flapping') NOT NULL, + event_time bigint(20) unsigned NOT NULL, + + PRIMARY KEY (id) +) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; From b7ed29c09531909a7c66738344a31729c5a9998a Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 2 Oct 2019 14:02:22 +0200 Subject: [PATCH 6/7] Schema: make *_downtime_history.triggered_by_id NULL DEFAULT NULL --- etc/schema/mysql/host.sql | 2 +- etc/schema/mysql/service.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/schema/mysql/host.sql b/etc/schema/mysql/host.sql index 053653f9..11980978 100644 --- a/etc/schema/mysql/host.sql +++ b/etc/schema/mysql/host.sql @@ -185,7 +185,7 @@ CREATE TABLE host_downtime_history ( downtime_id binary(20) NOT NULL COMMENT 'host_downtime.id', environment_id binary(20) NOT NULL COMMENT 'environment.id', host_id binary(20) NOT NULL COMMENT 'host.id', - triggered_by_id binary(20) NOT NULL COMMENT 'host_downtime.id', + triggered_by_id binary(20) NULL DEFAULT NULL COMMENT 'host_downtime.id', entry_time bigint(20) unsigned NOT NULL, author varchar(255) NOT NULL COLLATE utf8mb4_unicode_ci, diff --git a/etc/schema/mysql/service.sql b/etc/schema/mysql/service.sql index b3847758..48c5d2dc 100644 --- a/etc/schema/mysql/service.sql +++ b/etc/schema/mysql/service.sql @@ -178,7 +178,7 @@ CREATE TABLE service_downtime_history ( downtime_id binary(20) NOT NULL COMMENT 'service_downtime.id', environment_id binary(20) NOT NULL COMMENT 'environment.id', service_id binary(20) NOT NULL COMMENT 'service.id', - triggered_by_id binary(20) NOT NULL COMMENT 'service_downtime.id', + triggered_by_id binary(20) NULL DEFAULT NULL COMMENT 'service_downtime.id', entry_time bigint(20) unsigned NOT NULL, author varchar(255) NOT NULL COLLATE utf8mb4_unicode_ci, From bedcabcab9e584440f1bf079ca78a8c36488c991 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 2 Oct 2019 15:45:20 +0200 Subject: [PATCH 7/7] Schema: make *_*_history.{deletion_time,end_time} NULL DEFAULT NULL --- etc/schema/mysql/host.sql | 6 +++--- etc/schema/mysql/service.sql | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/etc/schema/mysql/host.sql b/etc/schema/mysql/host.sql index 11980978..d14847c6 100644 --- a/etc/schema/mysql/host.sql +++ b/etc/schema/mysql/host.sql @@ -200,7 +200,7 @@ CREATE TABLE host_downtime_history ( was_cancelled enum('y', 'n') NOT NULL, is_in_effect enum('y', 'n') NOT NULL, trigger_time bigint(20) unsigned NOT NULL, - deletion_time bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '0 = not deleted yet', + deletion_time bigint(20) unsigned NULL DEFAULT NULL, PRIMARY KEY (downtime_id) ) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; @@ -216,7 +216,7 @@ CREATE TABLE host_comment_history ( entry_type enum('comment','ack','downtime','flapping') NOT NULL, is_persistent enum('y','n') NOT NULL, expire_time bigint(20) unsigned DEFAULT NULL, - deletion_time bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '0 = not deleted yet', + deletion_time bigint(20) unsigned NULL DEFAULT NULL, PRIMARY KEY (comment_id) ) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; @@ -227,7 +227,7 @@ CREATE TABLE host_flapping_history ( host_id binary(20) NOT NULL COMMENT 'host.id', start_time bigint(20) unsigned NOT NULL, - end_time bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '0 = not ended yet', + end_time bigint(20) unsigned NULL DEFAULT NULL, percent_state_change float unsigned NOT NULL, flapping_threshold_low float unsigned NOT NULL, flapping_threshold_high float unsigned NOT NULL, diff --git a/etc/schema/mysql/service.sql b/etc/schema/mysql/service.sql index 48c5d2dc..dac18baf 100644 --- a/etc/schema/mysql/service.sql +++ b/etc/schema/mysql/service.sql @@ -193,7 +193,7 @@ CREATE TABLE service_downtime_history ( was_cancelled enum('y', 'n') NOT NULL, is_in_effect enum('y', 'n') NOT NULL, trigger_time bigint(20) unsigned NOT NULL, - deletion_time bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '0 = not deleted yet', + deletion_time bigint(20) unsigned NULL DEFAULT NULL, PRIMARY KEY (downtime_id) ) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; @@ -209,7 +209,7 @@ CREATE TABLE service_comment_history ( entry_type enum('comment','ack','downtime','flapping') NOT NULL, is_persistent enum('y','n') NOT NULL, expire_time bigint(20) unsigned DEFAULT NULL, - deletion_time bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '0 = not deleted yet', + deletion_time bigint(20) unsigned NULL DEFAULT NULL, PRIMARY KEY (comment_id) ) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin; @@ -220,7 +220,7 @@ CREATE TABLE service_flapping_history ( service_id binary(20) NOT NULL COMMENT 'service.id', start_time bigint(20) unsigned NOT NULL, - end_time bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '0 = not ended yet', + end_time bigint(20) unsigned NULL DEFAULT NULL, percent_state_change float unsigned NOT NULL, flapping_threshold_low float unsigned NOT NULL, flapping_threshold_high float unsigned NOT NULL,