Skip to content

Track schema upgrades with a flag instead of a hardcoded version check - #184

Open
snoopdave wants to merge 1 commit into
masterfrom
track-schema-upgrade-flag
Open

Track schema upgrades with a flag instead of a hardcoded version check#184
snoopdave wants to merge 1 commit into
masterfrom
track-schema-upgrade-flag

Conversation

@snoopdave

Copy link
Copy Markdown
Contributor

Follow-up to @mbien's review on #182.

DatabaseInstaller.upgradeDatabase decided whether to print "No table changes were required." from a hardcoded boolean 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 schemaUpgraded flag set inside each if (dbversion < XXX) upgrade block, with the message printed when !schemaUpgraded. The behavior is unchanged — at that point dbversion is already < myVersion and >= 310, so dbversion < 610 is 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

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
@snoopdave snoopdave added the 6.1.6 label Sep 8, 2026

@mbien mbien left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants