Skip to content

CheckSchema: Icinga DB Schema update file in error#1071

Open
oxzi wants to merge 3 commits intomainfrom
schema-upgrade-schema-version-to-release-name
Open

CheckSchema: Icinga DB Schema update file in error#1071
oxzi wants to merge 3 commits intomainfrom
schema-upgrade-schema-version-to-release-name

Conversation

@oxzi
Copy link
Member

@oxzi oxzi commented Feb 13, 2026

CheckSchema: Icinga DB Schema update file in error

When Icinga DB detects a schema version mismatch, the expected schema
version number is shown in the error message. Unfortunately, the
internal schema version number is not reflected in the schema upgrade
filenames, matching the Icinga DB release version.

For example, starting Icinga DB after upgrading to version 1.4.0 without
applying the schema upgrade first, would complain that schema version 7
is expected for MySQL and schema version 5 is expected for PostgreSQL,
respectively. However, the shipped schema upgrade files do not reflect
these version numbers, but are named 1.4.0.sql, after the Icinga DB
release.

This output is confusing for end users. Thus, an internal mapping of
schema version numbers to Icinga DB releases ware created, allowing to
output the expected schema version number together with the Icinga DB
release version.

> Starting Icinga DB daemon (1.5.1-ga395295-dirty)
> Connecting to database at 'mysql://root@localhost:3306/icingadb'
> unexpected database schema version: v7 (expected v8), please apply the 1.5.2.sql schema upgrade file to your database after upgrading Icinga DB: https://icinga.com/docs/icinga-db/latest/doc/04-Upgrading/

In order to have a single point to update these versions, the schema
version numbers where moved to internal/version.go, where the Icinga DB
version is also being defined.

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.

CheckSchema: Loosen schema upgrade check

In f49fac079893d79d1ccbb40df67c1ae2e0705c2c, a strict schema upgrade
history was enforced. This might result in reports due to misaligned,
but fixed schema upgrades.

Now, this check was loosened to only enforce that all schema updates
between the lowest and latest schema version were applied. If they are
not in order, only a warning is being produced.

Fixes #995.
Fixes #1068.

@oxzi oxzi added this to the 1.5.2 milestone Feb 13, 2026
@cla-bot cla-bot bot added the cla/signed label Feb 13, 2026
@oxzi oxzi changed the title Schema upgrade schema version to release name CheckSchema: Icinga DB Schema update file in error Feb 13, 2026
oxzi added 2 commits February 18, 2026 12:09
When Icinga DB detects a schema version mismatch, the expected schema
version number is shown in the error message. Unfortunately, the
internal schema version number is not reflected in the schema upgrade
filenames, matching the Icinga DB release version.

For example, starting Icinga DB after upgrading to version 1.4.0 without
applying the schema upgrade first, would complain that schema version 7
is expected for MySQL and schema version 5 is expected for PostgreSQL,
respectively. However, the shipped schema upgrade files do not reflect
these version numbers, but are named 1.4.0.sql, after the Icinga DB
release.

This output is confusing for end users. Thus, an internal mapping of
schema version numbers to Icinga DB releases ware created, allowing to
output the expected schema version number together with the Icinga DB
release version.

> Starting Icinga DB daemon (1.5.1-ga395295-dirty)
> Connecting to database at 'mysql://root@localhost:3306/icingadb'
> unexpected database schema version: v7 (expected v8), please apply the 1.5.2.sql schema upgrade file to your database after upgrading Icinga DB: https://icinga.com/docs/icinga-db/latest/doc/04-Upgrading/

In order to have a single point to update these versions, the schema
version numbers where moved to internal/version.go, where the Icinga DB
version is also being defined.
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.
@oxzi oxzi marked this pull request as draft February 18, 2026 11:09
In f49fac0, a strict schema upgrade
history was enforced. This might result in reports due to misaligned,
but fixed schema upgrades.

Now, this check was loosened to only enforce that all schema updates
between the lowest and latest schema version were applied. If they are
not in order, only a warning is being produced.
@oxzi oxzi force-pushed the schema-upgrade-schema-version-to-release-name branch from b00edda to 2b89147 Compare February 18, 2026 14:59
@oxzi oxzi marked this pull request as ready for review February 18, 2026 15:01
@oxzi oxzi requested a review from lippserd February 23, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Schema check fails if schema upgrade applied more than once Unify schema version number and schema file name in output

1 participant