Track schema upgrades with a flag instead of a hardcoded version check - #184
Open
snoopdave wants to merge 1 commit into
Open
Track schema upgrades with a flag instead of a hardcoded version check#184snoopdave wants to merge 1 commit into
snoopdave wants to merge 1 commit into
Conversation
upgradeDatabase decided whether to report "No table changes were required." from a hardcoded `dbversion < 610`, which has to be bumped by hand every time a new migration is added. Set a schemaUpgraded flag inside each upgrade block instead, so the message is derived from whether a step actually ran. Behavior is unchanged: at that point dbversion < 610 is true exactly when one of the upgrade blocks runs. Adds a test covering the schema-change path (the flag suppresses the "no changes" message) alongside the existing version-only case. Addresses review feedback from Michael Bien on #182. Claude-Session: https://claude.ai/code/session_015X69HHQ5XnjRkJP8ymzwFf
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.
Follow-up to @mbien's review on #182.
DatabaseInstaller.upgradeDatabasedecided whether to print "No table changes were required." from a hardcodedboolean schemaChangesRequired = dbversion < 610;. That constant is the last version with a migration script, so it has to be bumped by hand on every future schema change or the message goes wrong.This adopts the pattern Michael suggested: a
schemaUpgradedflag set inside eachif (dbversion < XXX)upgrade block, with the message printed when!schemaUpgraded. The behavior is unchanged — at that pointdbversionis already< myVersionand>= 310, sodbversion < 610is true exactly when one of the upgrade blocks runs — but the "did a schema step run?" answer is now derived rather than hardcoded, and the guiding comment tells the next maintainer to set the flag.Also adds a test for the schema-change path (a 520 database upgrading through the 520→610 step, asserting the "no changes" message is suppressed) next to the existing version-only case.
Validation: JDK 11 targeted run green (
DatabaseInstallerUpgradeTest, 2 tests, 0 failures).https://claude.ai/code/session_015X69HHQ5XnjRkJP8ymzwFf