CheckSchema: Icinga DB Schema update file in error#1071
Open
Conversation
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.
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.
b00edda to
2b89147
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #995.
Fixes #1068.