From b795becfd7c343015d88b94707d5e73e5538880f Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 4 Nov 2019 13:28:34 +0100 Subject: [PATCH] Schema: add state_history#previous_soft_state --- configobject/history/history.go | 5 +++-- etc/schema/mysql/mysql.schema.sql | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/configobject/history/history.go b/configobject/history/history.go index cafb3d41..69ca93f5 100644 --- a/configobject/history/history.go +++ b/configobject/history/history.go @@ -134,8 +134,8 @@ func notificationHistoryWorker(super *supervisor.Supervisor) { func stateHistoryWorker(super *supervisor.Supervisor) { statements := []string{ `REPLACE INTO state_history (id, environment_id, endpoint_id, object_type, host_id, service_id, event_time, state_type,` + - `soft_state, hard_state, previous_hard_state, attempt, last_soft_state, last_hard_state, output, long_output, max_check_attempts, check_source)` + - `VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, + `soft_state, hard_state, previous_soft_state, previous_hard_state, attempt, last_soft_state, last_hard_state, output, long_output, max_check_attempts, check_source)` + + `VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, `REPLACE INTO history (id, environment_id, endpoint_id, object_type, host_id, service_id, notification_history_id,` + `state_history_id, downtime_history_id, comment_history_id, flapping_history_id, event_type, event_time)` + `VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)`, @@ -161,6 +161,7 @@ func stateHistoryWorker(super *supervisor.Supervisor) { utils.IcingaStateTypeToString(float32(stateType)), values["soft_state"], values["hard_state"], + values["previous_soft_state"], values["previous_hard_state"], values["attempt"], values["last_soft_state"], diff --git a/etc/schema/mysql/mysql.schema.sql b/etc/schema/mysql/mysql.schema.sql index b536fe1f..41d857c6 100644 --- a/etc/schema/mysql/mysql.schema.sql +++ b/etc/schema/mysql/mysql.schema.sql @@ -824,6 +824,7 @@ CREATE TABLE state_history ( state_type enum('hard', 'soft') NOT NULL, soft_state tinyint(1) unsigned NOT NULL, hard_state tinyint(1) unsigned NOT NULL, + previous_soft_state tinyint(1) unsigned NOT NULL, previous_hard_state tinyint(1) unsigned NOT NULL, attempt tinyint(1) unsigned NOT NULL, last_soft_state tinyint(1) unsigned NOT NULL,