Commit graph

15 commits

Author SHA1 Message Date
Alexander A. Klimov
b6839ce9f0 cmd/icingadb-migrate: replace magic number 20 with sha1.Size 2024-07-09 13:30:08 +00:00
Alvar Penning
b7483eb6f8
icingadb-migrate: Verify env ID length
An env ID with the wrong length, either due to a copy-paste error or
human error during testing, results in a SQL CHECK CONSTRAINT violation
that is retried multiple times until it finally fails.
2024-07-09 13:24:01 +02:00
Eric Lippmann
7c068d4adf Use icinga-go-library 2024-05-24 09:56:28 +02:00
Eric Lippmann
8beb8616ad Move database related code from internal to database 2024-05-22 11:51:22 +02:00
Eric Lippmann
9eddcac7fb icingadb-migrate: Don't alias types import 2024-05-22 11:51:21 +02:00
Eric Lippmann
f54a142815 Move icingadb#DB to database#DB 2024-05-22 11:51:21 +02:00
Eric Lippmann
490c18fd5f Move database#DB.CheckSchema() to icingadb#CheckSchema() 2024-05-22 11:51:21 +02:00
Eric Lippmann
ed69f42462 Move utils#TableName() to database#TableName() 2024-05-22 11:51:21 +02:00
Eric Lippmann
9e70aa808c Move config to internal/config 2024-05-22 11:51:21 +02: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
a163694dc6 Config parsing: fail on unknown fields and print them
Useful against config validation or runtime failures
caused by wrong field spelling or YAML indentation.
2023-06-19 17:38:52 +02: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/main.go (Browse further)