From b09c6d56832eb1718c07d74abf3bc6ae3fe4e030 Mon Sep 17 00:00:00 2001
From: Daniel Baumann <daniel.baumann@progress-linux.org>
Date: Sun, 28 Apr 2024 14:36:04 +0200
Subject: Adding upstream version 1.1.0.

Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
---
 cmd/icingadb-migrate/embed/notification_query.sql | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100644 cmd/icingadb-migrate/embed/notification_query.sql

(limited to 'cmd/icingadb-migrate/embed/notification_query.sql')

diff --git a/cmd/icingadb-migrate/embed/notification_query.sql b/cmd/icingadb-migrate/embed/notification_query.sql
new file mode 100644
index 0000000..f963b2e
--- /dev/null
+++ b/cmd/icingadb-migrate/embed/notification_query.sql
@@ -0,0 +1,9 @@
+SELECT n.notification_id, n.notification_reason, UNIX_TIMESTAMP(n.end_time) end_time,
+  n.end_time_usec, n.state, COALESCE(n.output, '') output, n.long_output,
+  n.contacts_notified, o.objecttype_id, o.name1, COALESCE(o.name2, '') name2
+FROM icinga_notifications n USE INDEX (PRIMARY)
+INNER JOIN icinga_objects o ON o.object_id=n.object_id
+WHERE n.notification_id BETWEEN :fromid AND :toid
+AND n.notification_id <= :cache_limit AND n.notification_id > :checkpoint -- where we were interrupted
+ORDER BY n.notification_id -- this way we know what has already been migrated from just the last row's ID
+LIMIT :bulk
-- 
cgit v1.2.3

