claude-memory/graph/solutions/paper-dynasty-postgresql-migration-code-preparation-complete-f30198.md
Cal Corum b140d4d82a migrate: 313 memories from MemoryGraph
- 313 new markdown files created
- 30 relationships embedded
- 313 entries indexed
- State initialized with usage data
2026-02-13 11:11:48 -06:00

36 lines
1.4 KiB
Markdown

---
id: f3019888-18f9-443e-8b6c-b508ca179595
type: solution
title: "Paper Dynasty PostgreSQL migration - code preparation complete"
tags: [paper-dynasty, postgresql, migration, sqlite, database]
importance: 0.9
confidence: 0.8
created: "2026-01-26T05:05:06.884329+00:00"
updated: "2026-01-26T05:05:06.884329+00:00"
---
Completed Phase 1 of Paper Dynasty SQLite to PostgreSQL migration:
FILES CREATED:
- scripts/migrate_to_postgres.py - ID-preserving migration script with batch processing, FK error handling
- scripts/audit_sqlite.py - Pre-migration data integrity checker
- app/db_helpers.py - Cross-database upsert helpers for SQLite/PostgreSQL compatibility
- PROJECT_PLAN.json - Comprehensive migration tracking
- .secrets/pd_admin_credentials.txt - PostgreSQL credentials (gitignored)
CODE CHANGES:
- app/db_engine.py: Added unique indexes for StratPlay(game, play_num) and Decision(game, pitcher)
- app/db_engine.py: Added max_length to Team.abbrev, sname, lname fields
- 12 files updated: Replaced on_conflict_replace() with PostgreSQL-compatible upsert_*() helpers
- teams.py: Fixed boolean comparison (== 0/1 to == False/True)
AUDIT RESULTS:
- 658,963 total records across 29 tables
- 2,390 orphaned stats records (will be handled by migration script)
- No critical issues blocking migration
NEXT STEPS:
- Create pd_admin user and pd_master database on sba_postgres
- Test migration on dev server (ssh sba-db)
- Production migration with 1-4 hour maintenance window