Skip to content

db-schema: warn about the v_rpt_configuration question fan-out - #6

Open
selic wants to merge 2 commits into
mainfrom
db-schema/vrpt-config-fanout
Open

db-schema: warn about the v_rpt_configuration question fan-out#6
selic wants to merge 2 commits into
mainfrom
db-schema/vrpt-config-fanout

Conversation

@selic

@selic selic commented Aug 19, 2026

Copy link
Copy Markdown
Member

What

Live-verified schema gotcha found while running a lifecycle report through the sql toolset: v_rpt_configuration emits 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 on v_rpt_configuration (SELECT DISTINCT when listing; never join ticket/aggregate queries through it — use the bare Config table) and SR_Config (clean: one row per link, COUNT(*) = COUNT(DISTINCT SR_Service_RecID); Config.Company_RecID equals the REST company id)
  • src/reference/cw-db-schema.ts: regenerated — both notes now surface in cw_db_find_table
  • CLAUDE.md: gotcha recorded in the database section

All facts verified against the live instance. Build clean, 133/133 tests pass.

🤖 Generated with Claude Code

selic and others added 2 commits August 19, 2026 07:08
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>
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