Fix commenthistory

refs #5492
This commit is contained in:
Jean Flach 2017-08-10 16:42:02 +02:00 committed by Michael Friedrich
parent 30be02bcae
commit 1632415370
5 changed files with 24 additions and 4 deletions

View File

@ -409,7 +409,7 @@ void DbEvents::RemoveCommentInternal(std::vector<DbQuery>& queries, const Commen
query1.Category = DbCatComment;
query1.WhereCriteria = new Dictionary();
query1.WhereCriteria->Set("object_id", checkable);
query1.WhereCriteria->Set("comment_time", DbValue::FromTimestamp(entry_time));
query1.WhereCriteria->Set("entry_time", DbValue::FromTimestamp(entry_time));
query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
query1.WhereCriteria->Set("name", comment->GetName());
queries.push_back(query1);
@ -430,7 +430,7 @@ void DbEvents::RemoveCommentInternal(std::vector<DbQuery>& queries, const Commen
query2.WhereCriteria = new Dictionary();
query2.WhereCriteria->Set("object_id", checkable);
query2.WhereCriteria->Set("comment_time", DbValue::FromTimestamp(entry_time));
query2.WhereCriteria->Set("entry_time", DbValue::FromTimestamp(entry_time));
query2.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
query2.WhereCriteria->Set("name", comment->GetName());
queries.push_back(query2);

View File

@ -1682,9 +1682,12 @@ CREATE INDEX idx_service_contacts_service_id on icinga_service_contacts(service_
CREATE INDEX idx_host_contacts_host_id on icinga_host_contacts(host_id);
-- #5458
CREATE INDEX idx_downtimehistory_remove ON icinga_downtimehistory (object_id, entry_time, scheduled_start_time, scheduled_end_time);
CREATE INDEX idx_scheduleddowntime_remove ON icinga_scheduleddowntime (object_id, entry_time, scheduled_start_time, scheduled_end_time);
create index idx_downtimehistory_remove on icinga_downtimehistory (object_id, entry_time, scheduled_start_time, scheduled_end_time);
create index idx_scheduleddowntime_remove on icinga_scheduleddowntime (object_id, entry_time, scheduled_start_time, scheduled_end_time);
-- #5492
CREATE INDEX idx_commenthistory_remove ON icinga_commenthistory (object_id, entry_time);
CREATE INDEX idx_comments_remove ON icinga_comments (object_id, entry_time);
-- -----------------------------------------
-- set dbversion

View File

@ -16,6 +16,13 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
CREATE INDEX idx_downtimehistory_remove ON icinga_downtimehistory (object_id, entry_time, scheduled_start_time, scheduled_end_time);
CREATE INDEX idx_scheduleddowntime_remove ON icinga_scheduleddowntime (object_id, entry_time, scheduled_start_time, scheduled_end_time);
-- -----------------------------------------
-- #5492 IDO: Improve comment removal
-- -----------------------------------------
CREATE INDEX idx_commenthistory_remove ON icinga_commenthistory (object_id, entry_time);
CREATE INDEX idx_comments_remove ON icinga_comments (object_id, entry_time);
-- -----------------------------------------
-- set dbversion
-- -----------------------------------------

View File

@ -1725,6 +1725,10 @@ CREATE INDEX idx_host_contacts_host_id on icinga_host_contacts(host_id);
CREATE INDEX idx_downtimehistory_remove ON icinga_downtimehistory (object_id, entry_time, scheduled_start_time, scheduled_end_time);
CREATE INDEX idx_scheduleddowntime_remove ON icinga_scheduleddowntime (object_id, entry_time, scheduled_start_time, scheduled_end_time);
-- #5492
CREATE INDEX idx_commenthistory_remove ON icinga_commenthistory (object_id, entry_time);
CREATE INDEX idx_comments_remove ON icinga_comments (object_id, entry_time);
-- -----------------------------------------
-- set dbversion
-- -----------------------------------------

View File

@ -14,6 +14,12 @@
CREATE INDEX idx_downtimehistory_remove ON icinga_downtimehistory (object_id, entry_time, scheduled_start_time, scheduled_end_time);
CREATE INDEX idx_scheduleddowntime_remove ON icinga_scheduleddowntime (object_id, entry_time, scheduled_start_time, scheduled_end_time);
-- -----------------------------------------
-- #5492
-- -----------------------------------------
CREATE INDEX idx_commenthistory_remove ON icinga_commenthistory (object_id, entry_time);
CREATE INDEX idx_comments_remove ON icinga_comments (object_id, entry_time);
-- -----------------------------------------
-- set dbversion
-- -----------------------------------------