Repository navigation
Conversation
This was referenced Oct 20, 2026
Replace the db utils' own JDBC URL handling and scheme aliases with the shared helper from hanami-db (hanami/hanami-db#25). hanami-db is required only when resolving a database class, rather than at the top of utils/database.rb, since every app command loads that file, including in apps that do not use hanami-db (an optional dependency of hanami-cli).
Raise the existing (previously unused) UnsupportedDatabaseSchemeError for unsupported schemes, and a new InvalidDatabaseURLError for URLs that cannot be parsed, rather than a RuntimeError or URI::InvalidURIError. Neither includes the URL in its message, nor carries the URI error as its cause, since the URL may contain credentials.
hanami-db is an optional dependency, so hanami-cli's gemspec cannot require a minimum version of it. Apps upgrading hanami-cli while keeping an older hanami-db would otherwise hit a NameError for Hanami::DB::DatabaseURL when running `hanami db` commands. This matches the equivalent check in hanami's db provider.
Temporary, until hanami/hanami-db#25's changes are merged. Revert before merging.
parndt
force-pushed
the
database-url-helpers
branch
from
October 20, 2026 04:15
ac04253 to
6ce46d5
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.
Depends on hanami/hanami-db#26, which should be merged first. Part of hanami/hanami-db#25.
hanami dbcommands now use hanami-db's newHanami::DB::DatabaseURLto recognise database URLs, including JRuby's JDBC URLs. This replaces their own JDBC prefix handling and scheme aliases.Changes
Utils::Database.database_classresolves the database class fromDatabaseURL.adapter. The JDBC handling inDatabase#database_uriandSqlite#namenow uses the same helpers.UnsupportedDatabaseSchemeErrorrather than aRuntimeError. URLs that can't be parsed raise a newInvalidDatabaseURLErrorrather thanURI::InvalidURIError. Neither error includes the URL or carries the URI error as its cause, since the URL may contain credentials.DatabaseURL,hanami dbcommands raise a newHanamiDBVersionErrorexplaining how to upgrade. hanami-db is only required when a db command runs, since every app command loadsutils/database.rb.Before merging
main(temporarily atdatabase-url-helpersso CI runs against it)