icingadb-migrate: Mitigate NULL names in {comment,downtime}_query #767
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Historical data from an older Icinga 2 installation contained NULL values for the name column in some rows of the icinga_commenthistory and icinga_downtimehistory tables.
Normally this field contains something like
${name1}!${name2}!${unique_value} where the $unique_value is based on a timestamp for older entries and a UUID for newer ones. For a concrete example, this could be "host.example.com!ping6!123…".
Unfortunately, using an empty string for these NULL values will cause an error later because the new primary key will be calculated based on it. Therefore, a new deterministic name is generated based on the primary keys and the known name1 and name2 values.
Closes #766.