db-schema: warn about the v_rpt_configuration question fan-out - #6
Open
selic wants to merge 2 commits into
Open
Conversation
The view emits one row per config-type question (2-38 rows per config, live-verified: one service config produced 18,390 join rows for 613 real tickets). Annotate v_rpt_configuration (SELECT DISTINCT when listing, join the bare Config table for ticket/aggregate queries) and SR_Config (clean: one row per link; Config.Company_RecID equals the REST company id), and record the gotcha in CLAUDE.md. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
What
Live-verified schema gotcha found while running a lifecycle report through the
sqltoolset:v_rpt_configurationemits one row per config-type question (2–38 rows per config). Joining ticket queries through it silently multiplies every count — one service config showed 18,390 join rows for 613 real tickets (factor 30).Changes
scripts/db-enrich.mjs: notes onv_rpt_configuration(SELECT DISTINCT when listing; never join ticket/aggregate queries through it — use the bareConfigtable) andSR_Config(clean: one row per link,COUNT(*)=COUNT(DISTINCT SR_Service_RecID);Config.Company_RecIDequals the REST company id)src/reference/cw-db-schema.ts: regenerated — both notes now surface incw_db_find_tableCLAUDE.md: gotcha recorded in the database sectionAll facts verified against the live instance. Build clean, 133/133 tests pass.
🤖 Generated with Claude Code