From fcfb5e62f95d625836328131cc5ca851182bcae4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 13:41:39 +0200 Subject: Adding upstream version 1.2.0. Signed-off-by: Daniel Baumann --- schema/mysql/schema.sql | 10 +++++----- schema/mysql/upgrades/1.0.0-rc2.sql | 2 +- schema/mysql/upgrades/1.0.0.sql | 2 +- schema/mysql/upgrades/1.1.1.sql | 2 +- schema/mysql/upgrades/1.2.0.sql | 13 +++++++++++++ schema/mysql/upgrades/optional/1.2.0-history.sql | 1 + 6 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 schema/mysql/upgrades/1.2.0.sql create mode 100644 schema/mysql/upgrades/optional/1.2.0-history.sql (limited to 'schema/mysql') diff --git a/schema/mysql/schema.sql b/schema/mysql/schema.sql index f4434f1..745a5e6 100644 --- a/schema/mysql/schema.sql +++ b/schema/mysql/schema.sql @@ -292,7 +292,7 @@ CREATE TABLE host_state ( hard_state tinyint unsigned NOT NULL, previous_soft_state tinyint unsigned NOT NULL, previous_hard_state tinyint unsigned NOT NULL, - check_attempt tinyint unsigned NOT NULL, + check_attempt int unsigned NOT NULL, severity smallint unsigned NOT NULL, output longtext DEFAULT NULL, @@ -460,7 +460,7 @@ CREATE TABLE service_state ( hard_state tinyint unsigned NOT NULL, previous_soft_state tinyint unsigned NOT NULL, previous_hard_state tinyint unsigned NOT NULL, - check_attempt tinyint unsigned NOT NULL, + check_attempt int unsigned NOT NULL, severity smallint unsigned NOT NULL, output longtext DEFAULT NULL, @@ -1147,7 +1147,7 @@ CREATE TABLE state_history ( hard_state tinyint unsigned NOT NULL, previous_soft_state tinyint unsigned NOT NULL, previous_hard_state tinyint unsigned NOT NULL, - check_attempt tinyint unsigned NOT NULL, + check_attempt int unsigned NOT NULL, -- may be a tinyint unsigned, see https://icinga.com/docs/icinga-db/latest/doc/04-Upgrading/#upgrading-to-icinga-db-v112 output longtext DEFAULT NULL, long_output longtext DEFAULT NULL, max_check_attempts int unsigned NOT NULL, @@ -1289,7 +1289,7 @@ CREATE TABLE history ( CONSTRAINT fk_history_notification_history FOREIGN KEY (notification_history_id) REFERENCES notification_history (id) ON DELETE CASCADE, CONSTRAINT fk_history_state_history FOREIGN KEY (state_history_id) REFERENCES state_history (id) ON DELETE CASCADE, - INDEX idx_history_event_time (event_time) COMMENT 'History filtered/ordered by event_time', + INDEX idx_history_event_time_event_type (event_time, event_type) COMMENT 'History filtered/ordered by event_time/event_type', INDEX idx_history_acknowledgement (acknowledgement_history_id), INDEX idx_history_comment (comment_history_id), INDEX idx_history_downtime (downtime_history_id), @@ -1343,4 +1343,4 @@ CREATE TABLE icingadb_schema ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC; INSERT INTO icingadb_schema (version, timestamp) - VALUES (4, CURRENT_TIMESTAMP() * 1000); + VALUES (5, UNIX_TIMESTAMP() * 1000); diff --git a/schema/mysql/upgrades/1.0.0-rc2.sql b/schema/mysql/upgrades/1.0.0-rc2.sql index 50fb2f9..d4695cd 100644 --- a/schema/mysql/upgrades/1.0.0-rc2.sql +++ b/schema/mysql/upgrades/1.0.0-rc2.sql @@ -156,7 +156,7 @@ ALTER TABLE acknowledgement_history MODIFY is_persistent enum('n','y') DEFAULT NULL COMMENT 'NULL if ack_set event happened before Icinga DB history recording'; INSERT INTO icingadb_schema (version, timestamp) - VALUES (2, CURRENT_TIMESTAMP() * 1000); + VALUES (2, UNIX_TIMESTAMP() * 1000); ALTER TABLE host_state MODIFY output longtext DEFAULT NULL, diff --git a/schema/mysql/upgrades/1.0.0.sql b/schema/mysql/upgrades/1.0.0.sql index 16bb45e..054e10e 100644 --- a/schema/mysql/upgrades/1.0.0.sql +++ b/schema/mysql/upgrades/1.0.0.sql @@ -288,4 +288,4 @@ INSERT INTO sla_history_downtime ON DUPLICATE KEY UPDATE sla_history_downtime.downtime_id = sla_history_downtime.downtime_id; INSERT INTO icingadb_schema (version, TIMESTAMP) - VALUES (3, CURRENT_TIMESTAMP() * 1000); + VALUES (3, UNIX_TIMESTAMP() * 1000); diff --git a/schema/mysql/upgrades/1.1.1.sql b/schema/mysql/upgrades/1.1.1.sql index 264ecae..b0d5b69 100644 --- a/schema/mysql/upgrades/1.1.1.sql +++ b/schema/mysql/upgrades/1.1.1.sql @@ -34,4 +34,4 @@ ALTER TABLE history UNLOCK TABLES; INSERT INTO icingadb_schema (version, timestamp) - VALUES (4, CURRENT_TIMESTAMP() * 1000); + VALUES (4, UNIX_TIMESTAMP() * 1000); diff --git a/schema/mysql/upgrades/1.2.0.sql b/schema/mysql/upgrades/1.2.0.sql new file mode 100644 index 0000000..74cbcb1 --- /dev/null +++ b/schema/mysql/upgrades/1.2.0.sql @@ -0,0 +1,13 @@ +UPDATE icingadb_schema SET timestamp = UNIX_TIMESTAMP(timestamp / 1000) * 1000 WHERE timestamp > 20000000000000000; + +ALTER TABLE history ADD INDEX idx_history_event_time_event_type (event_time, event_type) COMMENT 'History filtered/ordered by event_time/event_type'; +ALTER TABLE history DROP INDEX idx_history_event_time; + +ALTER TABLE host_state MODIFY COLUMN check_attempt int unsigned NOT NULL; + +ALTER TABLE service_state MODIFY COLUMN check_attempt int unsigned NOT NULL; + +ALTER TABLE state_history MODIFY COLUMN check_attempt tinyint unsigned NOT NULL COMMENT 'optional schema upgrade not applied yet, see https://icinga.com/docs/icinga-db/latest/doc/04-Upgrading/#upgrading-to-icinga-db-v112'; + +INSERT INTO icingadb_schema (version, timestamp) + VALUES (5, UNIX_TIMESTAMP() * 1000); diff --git a/schema/mysql/upgrades/optional/1.2.0-history.sql b/schema/mysql/upgrades/optional/1.2.0-history.sql new file mode 100644 index 0000000..4081fcb --- /dev/null +++ b/schema/mysql/upgrades/optional/1.2.0-history.sql @@ -0,0 +1 @@ +ALTER TABLE state_history MODIFY COLUMN check_attempt int unsigned NOT NULL; -- cgit v1.2.3