All checks were successful
Reindex Knowledge Base / reindex (push) Successful in 2s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3.7 KiB
3.7 KiB
| title | description | type | domain | tags | ||||
|---|---|---|---|---|---|---|---|---|
| Major Domo Database Release — 2026.3.17 | Database migration and schema changes for Major Domo v2 on 2026-03-17. | reference | server-configs |
|
Major Domo Database Release — 2026.3.17
Date: 2026-03-17
Branch: next-release → main (PR #64, 11 commits)
Repo: cal/major-domo-database
Server: akamai (sba_db_api container, port 801)
Release Summary
11 commits from next-release rebased onto main. Mix of query performance improvements, bug fixes, and code quality cleanup. No schema migrations — safe drop-in deploy.
Performance
- Push limit/offset to DB in
PlayerService.get_players(#37): Previously fetched all rows then sliced in Python. Now passesLIMIT/OFFSETdirectly to the Peewee query, eliminating full-table reads on paginated requests. - Eliminate N+1 queries in batch POST endpoints (#25): Replaced per-row
get_or_none()loops inbattingstats,results,schedules, andtransactionsbatch insert endpoints with a single bulk set-lookup before the write loop.
Bug Fixes
- Fix
lob_2outsandrbipercentcalculation inSeasonPitchingStats(#28): Both fields were returning incorrect values due to wrong formula inputs. Now computed correctly from the underlying stat columns. - Invalidate cache after
PlayerServicewrite operations (#32): Cache was being populated on reads but never invalidated on writes, causing stale player data to persist until the next restart. - Validate
sort_byparameter withLiteraltype inviews.py(#36): Unvalidatedsort_bycould cause silent no-ops or unexpected ordering. Now enforced with aLiteraltype annotation, raising a 422 on invalid values.
Code Quality
- Replace bare
except:withexcept Exception:(#29): SilencingKeyboardInterrupt,SystemExit, andGeneratorExitis an antipattern. All 6 instances updated. - Remove unused imports in
standings.pyandpitchingstats.py(#30): Dead imports removed (pydanticinstandings.py). - Replace
print(req.scope)withlogger.debugin/api/docs(#21): Debug print statement that logged full request scope on every docs page load replaced with a conditional logger call. - Remove empty
WEEK_NUMSdict fromdb_engine.py(#34): Unused stub dict removed. - Remove unimplementable skipped caching tests (#33): Tests marked
@pytest.mark.skipfor a caching interface that was never built. Removed rather than leaving permanently skipped.
Conflict Resolution
Branch was rebased (not squash-merged) onto main. Six files had textual conflicts from two main-branch fixes that landed after next-release diverged:
Trailing slash regression (6 router files)
- PR #61 on main fixed a production bug:
aiohttpconverts POST→GET on 307 redirects, silently dropping request bodies. The fix changed all@router.post("")→@router.post("/"). - next-release's batch N+1 and bare-except PRs all touched the same files with the old
""signature. - Resolution: kept
@router.post("/")from main, applied next-release's functional changes on top.
Case-insensitive team_abbrev filter (transactions.py)
- PR #60 on main fixed affiliate roster transactions being silently dropped due to case mismatch (input uppercased, DB column mixed-case). Fix used
fn.UPPER(Team.abbrev). - next-release's version of
transactions.pypredated this fix. - Resolution: preserved
fn.UPPER(Team.abbrev)from main alongside next-release's N+1 fix.
requirements.txt
- Main has fully pinned deps including
starlette==0.52.1(from 2026-03-09 outage) and a newrequirements-dev.txt. - next-release had loose pins and no
requirements-dev.txt. - Resolution: took main's fully-pinned version entirely.