Skip to content

Empty database prefixes no longer produce leading underscores in table names - #31

Open
alexstandiford wants to merge 1 commit into
mainfrom
conductor/907-empty-prefix-underscore
Open

Empty database prefixes no longer produce leading underscores in table names#31
alexstandiford wants to merge 1 commit into
mainfrom
conductor/907-empty-prefix-underscore

Conversation

@alexstandiford

Copy link
Copy Markdown
Contributor

Charter: billing-service: tables are created with a leading underscore when DB_PREFIX is empty (Charter 907).

Why: Str::append('', '_') returns '_', and Table::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_subscriptions in production with an empty DB_PREFIX. The fix scopes the change to Table::getName() through a private helper, an empty prefix now contributes nothing, and a non-empty prefix keeps the exact prior prefix_ format. Str::append itself 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.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant