fix(db): use bigint for token counter columns in user_stats#3755
fix(db): use bigint for token counter columns in user_stats#3755waleedlatif1 merged 1 commit intostagingfrom
Conversation
PR SummaryMedium Risk Overview Adds a DB migration ( Written by Cursor Bugbot for commit c061ee1. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR fixes an integer overflow (
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant App as Application Code
participant Drizzle as Drizzle ORM
participant PG as PostgreSQL user_stats
App->>Drizzle: sql`total_tokens_used + ${tokens}`
Drizzle->>PG: UPDATE user_stats SET total_tokens_used = total_tokens_used + N
Note over PG: Previously int4 (max ~2.1B)<br/>Now bigint (max ~9.2 × 10^18)
PG-->>Drizzle: bigint value returned
Note over Drizzle: mode:'number' maps<br/>bigint → JS number<br/>(safe up to 2^53 - 1)
Drizzle-->>App: TypeScript number type (unchanged)
Reviews (1): Last reviewed commit: "fix(db): use bigint for token counter co..." | Re-trigger Greptile |
Summary
total_tokens_usedandtotal_copilot_tokensfromintegertobigintinuser_statstable22003) when updating user stats for heavy-usage accountsType of Change
Testing
Tested manually
Checklist