Move Redis Schema Version to internal/version.go

After moving the database schema version number to the
internal/version.go file, the Redis schema version was moved there
as well. Now there is only one place left in the codebase to define
versions.

This reflects the release issue template, listing the
internal/version.go to be checked.
This commit is contained in:
Alvar Penning 2026-02-13 10:48:17 +01:00
parent 1dc6e1496a
commit c4d7ed314a
No known key found for this signature in database
2 changed files with 9 additions and 5 deletions

View file

@ -29,9 +29,8 @@ import (
)
const (
ExitSuccess = 0
ExitFailure = 1
expectedRedisSchemaVersion = "6"
ExitSuccess = 0
ExitFailure = 1
)
func main() {
@ -421,13 +420,13 @@ func checkRedisSchema(logger *logging.Logger, rc *redis.Client, pos string) (new
}
message := streams[0].Messages[0]
if version := message.Values["version"]; version != expectedRedisSchemaVersion {
if version := message.Values["version"]; version != internal.RedisSchemaVersion {
// Since these error messages are trivial and mostly caused by users, we don't need
// to print a stack trace here. However, since errors.Errorf() does this automatically,
// we need to use fmt instead.
return "", fmt.Errorf(
"unexpected Redis schema version: %q (expected %q), please make sure you are running compatible"+
" versions of Icinga 2 and Icinga DB", version, expectedRedisSchemaVersion,
" versions of Icinga 2 and Icinga DB", version, internal.RedisSchemaVersion,
)
}

View file

@ -33,3 +33,8 @@ var PgSqlSchemaVersions = map[uint16]string{
4: "1.2.1",
5: "1.4.0",
}
// RedisSchemaVersion is the expected Redis schema version.
//
// This version must match between Icinga 2 and Icinga DB.
var RedisSchemaVersion = "6"