Empty database prefixes no longer produce leading underscores in table names - #31
Open
alexstandiford wants to merge 1 commit into
Open
Empty database prefixes no longer produce leading underscores in table names#31alexstandiford wants to merge 1 commit into
alexstandiford wants to merge 1 commit into
Conversation
…e names
Str::append('', '_') returns '_', so Table::getName() prepended a bare
underscore for every empty global or local prefix, silently corrupting
table names (billing-service observed _billing_subscriptions with an
empty DB_PREFIX). Non-empty prefixes keep the exact prior format; only
the empty-prefix contribution changes, from '_' to nothing.
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.
Charter: billing-service: tables are created with a leading underscore when DB_PREFIX is empty (Charter 907).
Why:
Str::append('', '_')returns'_', andTable::getName()called it unconditionally for both the global and the local prefix, so an empty prefix still contributed a bare underscore. billing-service observed_billing_subscriptionsin production with an emptyDB_PREFIX. The fix scopes the change toTable::getName()through a private helper, an empty prefix now contributes nothing, and a non-empty prefix keeps the exact priorprefix_format.Str::appenditself is untouched because other callers rely on its contract.Tests: four new unit cases pin the contract, both prefixes set (
glob_loc_name), empty global (loc_name), empty local (glob_name), and both empty (name). Full suite passes, 21 tests, 44 assertions, no existing test weakened.Deployment note for reviewers: any database that was created under the corrupted naming already has underscore-prefixed tables. A service that upgrades this package with an empty prefix will start resolving the corrected names, so those installs need a one-time table rename (or a temporary local prefix matching the old name) coordinated with the upgrade. billing-service production is the known case.
This pull request was prepared by the Novatorius fleet's Conductor agent and rides this workstation's configured GitHub credential.