Commit Graph

23 Commits

Author SHA1 Message Date
Cal Corum
40c512c665 Add PostgreSQL compatibility fixes for query ordering
- Add explicit ORDER BY id to all queries for consistent results across SQLite and PostgreSQL
- PostgreSQL does not guarantee row order without ORDER BY, unlike SQLite
- Skip table creation when DATABASE_TYPE=postgresql (production tables already exist)
- Fix datetime handling in notifications (PostgreSQL native datetime vs SQLite timestamp)
- Fix grouped query count() calls that don't work in PostgreSQL
- Update .gitignore to include storage/templates/ directory

This completes the PostgreSQL migration compatibility layer while maintaining
backwards compatibility with SQLite for local development.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 10:39:14 -06:00
Cal Corum
0cba52cea5 PostgreSQL migration: Complete code preparation phase
- Add db_helpers.py with cross-database upsert functions for SQLite/PostgreSQL
- Replace 12 on_conflict_replace() calls with PostgreSQL-compatible upserts
- Add unique indexes: StratPlay(game, play_num), Decision(game, pitcher)
- Add max_length to Team model fields (abbrev, sname, lname)
- Fix boolean comparison in teams.py (== 0/1 to == False/True)
- Create migrate_to_postgres.py with ID-preserving migration logic
- Create audit_sqlite.py for pre-migration data integrity checks
- Add PROJECT_PLAN.json for migration tracking
- Add .secrets/ to .gitignore for credentials

Audit results: 658,963 records across 29 tables, 2,390 orphaned stats (expected)

Based on Major Domo migration lessons learned (33 issues resolved there)
2026-01-25 23:05:54 -06:00
Cal Corum
1e4569dfbf Clean up root_validators
Remove root_path from FastAPI
Update Season 8 Cardsets
Force pydantic 1.x
2024-11-03 01:46:40 -05:00
Cal Corum
a265b83c63 Add support for exhibition games 2024-07-14 13:23:15 -05:00
Cal Corum
18a6ed2ebd Support for Exhibition games & Swagger updates 2024-07-11 15:07:23 -05:00
Cal Corum
eb49ded2d4 Add player_id to ratings & flashback rename 2023-11-20 01:00:10 -06:00
Cal Corum
d9a63e1949 Add scouting update endpoint 2023-11-18 14:45:09 -06:00
Cal Corum
c0a94613a3 Serve scouting by static csv 2023-10-30 10:25:44 -05:00
Cal Corum
24cf331803 Pitching Basic Ratings Complete + Batting Refactor 2023-10-29 17:48:38 -05:00
Cal Corum
053f577c45 Tweak OF Arm rating 2023-10-29 14:10:39 -05:00
Cal Corum
6dfbd33605 Update battingcardratings.py
Move db.close() to proper spot later in function
2023-10-29 00:50:01 -05:00
Cal Corum
1a9f15b489 Clear excess logging 2023-10-27 20:05:12 -05:00
Cal Corum
4e60c11b3d Finished basic ratings 2023-10-27 15:27:33 -05:00
Cal Corum
b5d10f0060 Added Arm rating 2023-10-27 14:21:44 -05:00
Cal Corum
d3c4e4b575 Added Reaction to basic ratings 2023-10-27 12:54:54 -05:00
Cal Corum
0a59d3e98d Moved AI lineup creation to db 2023-10-21 15:31:36 -05:00
Cal Corum
ed6e73528f Added /scouting error messages 2023-10-20 16:02:43 -05:00
Cal Corum
96be768ec9 Pre-Season 6 Updates 2023-10-19 23:16:47 -05:00
Cal Corum
a44250803a Batting Card Generation Complete 2023-10-14 23:43:50 -05:00
Cal Corum
89aebd441d Phase 1 card images 2023-09-24 18:59:32 -05:00
Cal Corum
6183a125bc Cards and ratings updates 2023-09-16 17:21:01 -05:00
Cal Corum
51a5251c92 Add pitchercards and ratings 2023-09-16 00:05:10 -05:00
Cal Corum
22cc01d200 Added battingcards and ratings 2023-09-15 22:38:15 -05:00