From 03b0e848083aa67727ade092d6ec94641899af69 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 19 Dec 2022 16:01:04 +0100 Subject: [PATCH] convertFlappingRows(): fix foreign key error history -> flapping_history Don't INSERT IGNORE everything, then UPSERT everything. Instead INSERT IGNORE flapping_history, UPSERT flapping_history and finally INSERT IGNORE history. --- cmd/icingadb-migrate/convert.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/icingadb-migrate/convert.go b/cmd/icingadb-migrate/convert.go index c061c3407..1d5dd5bad 100644 --- a/cmd/icingadb-migrate/convert.go +++ b/cmd/icingadb-migrate/convert.go @@ -508,10 +508,13 @@ func convertFlappingRows( } } - stages = []icingaDbOutputStage{{ - inserts: [][]contracts.Entity{flappingHistory, allHistory}, - upserts: [][]contracts.Entity{flappingHistoryUpserts}, - }} + stages = []icingaDbOutputStage{ + { + inserts: [][]contracts.Entity{flappingHistory}, + upserts: [][]contracts.Entity{flappingHistoryUpserts}, + }, + {inserts: [][]contracts.Entity{allHistory}}, + } return }