Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/icingadb-migrate: ignore icinga_downtimehistory#was_started=0 rows #623

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/icingadb-migrate/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ type downtimeRow = struct {
Duration int64
ScheduledStartTime sql.NullInt64
ScheduledEndTime int64
WasStarted uint8
ActualStartTime int64
ActualStartTimeUsec uint32
ActualEndTime int64
Expand All @@ -246,7 +247,7 @@ func convertDowntimeRows(
for _, row := range idoRows {
checkpoint = row.DowntimehistoryId

if !row.ScheduledStartTime.Valid {
if !row.ScheduledStartTime.Valid || row.WasStarted == 0 {
continue
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/icingadb-migrate/embed/downtime_query.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SELECT dh.downtimehistory_id, UNIX_TIMESTAMP(dh.entry_time) entry_time, dh.author_name, dh.comment_data,
dh.is_fixed, dh.duration, UNIX_TIMESTAMP(dh.scheduled_start_time) scheduled_start_time,
COALESCE(UNIX_TIMESTAMP(dh.scheduled_end_time), 0) scheduled_end_time,
COALESCE(UNIX_TIMESTAMP(dh.scheduled_end_time), 0) scheduled_end_time, dh.was_started,
COALESCE(UNIX_TIMESTAMP(dh.actual_start_time), 0) actual_start_time, dh.actual_start_time_usec,
COALESCE(UNIX_TIMESTAMP(dh.actual_end_time), 0) actual_end_time, dh.actual_end_time_usec, dh.was_cancelled,
COALESCE(UNIX_TIMESTAMP(dh.trigger_time), 0) trigger_time, dh.name, o.objecttype_id,
Expand Down
Loading