From 07615f14e87d0d96d08f0d4c506555336d3fa1e2 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 6 Feb 2014 16:01:03 +0100 Subject: [PATCH] DB IDO: Add check_source to statehistory table. Refs #5470 --- components/db_ido_mysql/schema/mysql.sql | 4 ++++ components/db_ido_pgsql/schema/pgsql.sql | 3 +++ lib/db_ido/servicedbobject.cpp | 1 + 3 files changed, 8 insertions(+) diff --git a/components/db_ido_mysql/schema/mysql.sql b/components/db_ido_mysql/schema/mysql.sql index 14040cbec..97012fa7b 100644 --- a/components/db_ido_mysql/schema/mysql.sql +++ b/components/db_ido_mysql/schema/mysql.sql @@ -1277,6 +1277,7 @@ CREATE TABLE IF NOT EXISTS icinga_statehistory ( last_hard_state smallint default 0, output TEXT character set latin1 default '', long_output TEXT default '', + check_source varchar(255) character set latin1 default NULL, PRIMARY KEY (statehistory_id) ) ENGINE=InnoDB COMMENT='Historical host and service state changes'; @@ -1524,6 +1525,9 @@ CREATE INDEX sla_idx_sthist ON icinga_statehistory (object_id, state_time DESC); CREATE INDEX sla_idx_dohist ON icinga_downtimehistory (object_id, actual_start_time, actual_end_time); 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); + -- ----------------------------------------- -- set dbversion -- ----------------------------------------- diff --git a/components/db_ido_pgsql/schema/pgsql.sql b/components/db_ido_pgsql/schema/pgsql.sql index 1c14cd53e..f7e7e94fd 100644 --- a/components/db_ido_pgsql/schema/pgsql.sql +++ b/components/db_ido_pgsql/schema/pgsql.sql @@ -1303,6 +1303,7 @@ 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) ) ; @@ -1550,6 +1551,8 @@ CREATE INDEX sla_idx_sthist ON icinga_statehistory (object_id, state_time DESC); CREATE INDEX sla_idx_dohist ON icinga_downtimehistory (object_id, actual_start_time, actual_end_time); 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); -- ----------------------------------------- -- set dbversion diff --git a/lib/db_ido/servicedbobject.cpp b/lib/db_ido/servicedbobject.cpp index 72d144273..6b7dff5c2 100644 --- a/lib/db_ido/servicedbobject.cpp +++ b/lib/db_ido/servicedbobject.cpp @@ -861,6 +861,7 @@ void ServiceDbObject::AddStateChangeHistory(const Service::Ptr& service, const C if (cr) { fields1->Set("output", CompatUtility::GetCheckResultOutput(cr)); fields1->Set("long_output", CompatUtility::GetCheckResultLongOutput(cr)); + fields1->Set("check_source", cr->GetCheckSource()); } fields1->Set("instance_id", 0); /* DbConnection class fills in real ID */