Merge pull request #84 from Icinga/feature/history-removed-by-and-cancelled-by

History: Add cancelled_by & removed_by to downtime & comment history
This commit is contained in:
Alexander Aleksandrovič Klimov 2019-12-09 14:09:42 +01:00 committed by GitHub
commit 6cdb07bc0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -243,8 +243,8 @@ func stateHistoryWorker(super *supervisor.Supervisor) {
func downtimeHistoryWorker(super *supervisor.Supervisor) {
statements := []string{
`REPLACE INTO downtime_history (downtime_id, environment_id, endpoint_id, triggered_by_id, object_type, host_id, service_id, entry_time,` +
`author, comment, is_flexible, flexible_duration, scheduled_start_time, scheduled_end_time, start_time, end_time, has_been_cancelled, trigger_time, cancel_time)` +
`VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`,
`author, cancelled_by, comment, is_flexible, flexible_duration, scheduled_start_time, scheduled_end_time, start_time, end_time, has_been_cancelled, trigger_time, cancel_time)` +
`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 (?,?,?,?,?,?,?,?,?,?,?,?,?)`,
@ -267,6 +267,7 @@ func downtimeHistoryWorker(super *supervisor.Supervisor) {
utils.DecodeHexIfNotNil(values["service_id"]),
values["entry_time"],
values["author"],
values["cancelled_by"],
values["comment"],
utils.RedisIntToDBBoolean(values["is_flexible"]),
values["flexible_duration"],
@ -319,8 +320,8 @@ func downtimeHistoryWorker(super *supervisor.Supervisor) {
func commentHistoryWorker(super *supervisor.Supervisor) {
statements := []string{
`REPLACE INTO comment_history (comment_id, environment_id, endpoint_id, object_type, host_id, service_id, entry_time, author,` +
`comment, entry_type, is_persistent, is_sticky, expire_time, remove_time, has_been_removed)` +
`VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`,
`removed_by, comment, entry_type, is_persistent, is_sticky, expire_time, remove_time, has_been_removed)` +
`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 (?,?,?,?,?,?,?,?,?,?,?,?,?)`,
@ -337,6 +338,7 @@ func commentHistoryWorker(super *supervisor.Supervisor) {
utils.DecodeHexIfNotNil(values["service_id"]),
values["entry_time"],
values["author"],
values["removed_by"],
values["comment"],
utils.CommentEntryTypes[values["entry_type"].(string)],
utils.RedisIntToDBBoolean(values["is_persistent"]),

View file

@ -874,6 +874,7 @@ CREATE TABLE downtime_history (
entry_time bigint(20) unsigned NOT NULL,
author varchar(255) NOT NULL COLLATE utf8mb4_unicode_ci,
cancelled_by varchar(255) NULL DEFAULT NULL COLLATE utf8mb4_unicode_ci,
comment text NOT NULL,
is_flexible enum('y', 'n') NOT NULL,
flexible_duration bigint(20) unsigned NOT NULL,
@ -898,6 +899,7 @@ CREATE TABLE comment_history (
entry_time bigint(20) unsigned NOT NULL,
author varchar(255) NOT NULL COLLATE utf8mb4_unicode_ci,
removed_by varchar(255) NULL DEFAULT NULL COLLATE utf8mb4_unicode_ci,
comment text NOT NULL,
entry_type enum('comment','ack') NOT NULL,
is_persistent enum('y','n') NOT NULL,