Commit graph

14 commits

Author SHA1 Message Date
Eric Lippmann
7c068d4adf Use icinga-go-library 2024-05-24 09:56:28 +02:00
Eric Lippmann
1ddaa70aab Move special types to icingadb/types 2024-05-22 11:51:21 +02:00
Eric Lippmann
9eddcac7fb icingadb-migrate: Don't alias types import 2024-05-22 11:51:21 +02:00
Eric Lippmann
75501e11f8 Move database related contracts to database/contracts 2024-05-22 11:51:21 +02:00
Alexander A. Klimov
2681634105 Unify check attempt data type to uint32 already used somewhere
A float isn't necessary as in Icinga 2 Checkable#max_check_attempts and
check_attempt are ints. But uint8 isn't enough for e.g. 1 check/s to get
HARD after 5m (300s > 255).
2024-04-08 16:01:53 +02:00
Alexander A. Klimov
10afc562ce Use types.MakeString() instead of manual initialization (refactor) 2024-03-25 14:52:54 +01:00
Julian Brost
336ee4a8ab
Merge pull request #554 from Icinga/553
convertFlappingRows(): fix foreign key error history -> flapping_history
2023-07-31 15:00:39 +02:00
Julian Brost
71c1d2fa4d Migration: refactor output/processing of converted entities
This commit simplifies the `icingaDbOutputStage` type to contain only one
entity slice to be insert/upsert. This allows to simplify the handling in
`migrateOneType()` by removing nested loops.

Additionally, a bit of code inside that function is outsourced into a new
`utils.ChanFromSlice()` function. This makes the body of the loop over the
insert/upsert operation (the loop using the `op` variable) simple enough so
that it can just be unrolled which saves the inline struct and slice definition
for that loop.
2023-07-31 11:10:42 +02:00
Alexander A. Klimov
78327c1f34 cmd/icingadb-migrate: ignore icinga_downtimehistory#was_started=0 rows
Such appear e.g. for scheduled but never triggered flexible Downtimes.
Not triggered = no events.
2023-07-27 17:29:33 +02:00
Alexander A. Klimov
3d571548e8 icingadb-migrate: handle NULL event time columns
Ignore such rows.
2023-05-26 12:50:41 +02:00
Alexander A. Klimov
03b0e84808 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.
2022-12-19 16:07:55 +01:00
Alexander A. Klimov
a778fc8d34 migrateOneType(): allow multiple stages of INSERT IGNORE, UPSERT
Refactor the converters so they can signal the caller to behave not as usual
i.e. not to INSERT IGNORE everything, then UPSERT everything.
2022-12-19 16:07:53 +01:00
Alexander A. Klimov
cfaee2e3d4 cmd/icingadb-migrate: avoid unnecessary config option
for columns which are NULLable anyway.
2022-11-07 12:35:31 +01:00
Alexander A. Klimov
6a5f3fd02f cmd/: rename ido2icingadb/ to icingadb-migrate/ 2022-10-26 11:18:52 +02:00
Renamed from cmd/ido2icingadb/convert.go (Browse further)