2022-05-19 05:46:49 -04:00
|
|
|
SELECT ch.commenthistory_id, UNIX_TIMESTAMP(ch.entry_time) entry_time,
|
|
|
|
|
ch.entry_time_usec, ch.entry_type, ch.author_name, ch.comment_data, ch.is_persistent,
|
|
|
|
|
COALESCE(UNIX_TIMESTAMP(ch.expiration_time), 0) expiration_time,
|
|
|
|
|
COALESCE(UNIX_TIMESTAMP(ch.deletion_time), 0) deletion_time,
|
2024-07-09 07:05:36 -04:00
|
|
|
ch.deletion_time_usec,
|
|
|
|
|
COALESCE(ch.name, CONCAT(o.name1, '!', COALESCE(o.name2, ''), '!', ch.commenthistory_id, '-', ch.object_id)) name,
|
|
|
|
|
o.objecttype_id, o.name1, COALESCE(o.name2, '') name2
|
2022-05-19 05:46:49 -04:00
|
|
|
FROM icinga_commenthistory ch USE INDEX (PRIMARY)
|
|
|
|
|
INNER JOIN icinga_objects o ON o.object_id=ch.object_id
|
2022-09-06 09:50:04 -04:00
|
|
|
WHERE ch.commenthistory_id BETWEEN :fromid AND :toid
|
|
|
|
|
AND ch.commenthistory_id > :checkpoint -- where we were interrupted
|
2022-05-19 11:11:45 -04:00
|
|
|
ORDER BY ch.commenthistory_id -- this way we know what has already been migrated from just the last row's ID
|
2022-05-19 05:46:49 -04:00
|
|
|
LIMIT :bulk
|