paper-dynasty-database/scripts/audit_results.json
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

92 lines
2.0 KiB
JSON

{
"generated_at": "2026-01-25T23:04:23.049271",
"summary": {
"total_tables": 29,
"total_records": 658963,
"total_issues": 3,
"critical_issues": 0,
"high_issues": 3,
"medium_issues": 0
},
"table_counts": {
"award": 0,
"battingcard": 6036,
"battingcardratings": 12072,
"battingstat": 50228,
"card": 61746,
"cardposition": 18654,
"cardset": 29,
"current": 1,
"decision": 29694,
"event": 9,
"gamerewards": 10,
"gauntletreward": 45,
"gauntletrun": 458,
"mlbplayer": 4781,
"notification": 14362,
"pack": 20595,
"packtype": 9,
"paperdex": 46121,
"pitchingcard": 6887,
"pitchingcardratings": 13774,
"pitchingstat": 13135,
"player": 12964,
"rarity": 6,
"result": 2235,
"reward": 8043,
"roster": 23,
"stratgame": 4208,
"stratplay": 332737,
"team": 101
},
"issues": [
{
"type": "ORPHANED_FK",
"severity": "HIGH",
"child_table": "battingstat",
"child_field": "card_id",
"parent_table": "card",
"parent_field": "id",
"description": "Batting stats referencing non-existent cards",
"orphan_count": 1953,
"sample_orphan_ids": [
1419,
1419,
1419,
1419,
1433
]
},
{
"type": "ORPHANED_FK",
"severity": "HIGH",
"child_table": "pitchingstat",
"child_field": "card_id",
"parent_table": "card",
"parent_field": "id",
"description": "Pitching stats referencing non-existent cards",
"orphan_count": 437,
"sample_orphan_ids": [
1412,
1660,
2045,
2046,
2061
]
},
{
"type": "VARCHAR_TOO_LONG",
"severity": "HIGH",
"table": "team",
"field": "abbrev",
"description": "Team abbreviation",
"max_found": 13,
"expected_max": 10,
"sample_values": [
"Gauntlet-KC...",
"Gauntlet-NCB...",
"Gauntlet-SLV..."
]
}
]
}