mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
fix(db): use bigint for token counter columns in user_stats (#3755)
This commit is contained in:
2
packages/db/migrations/0181_dazzling_the_leader.sql
Normal file
2
packages/db/migrations/0181_dazzling_the_leader.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE "user_stats" ALTER COLUMN "total_tokens_used" SET DATA TYPE bigint;--> statement-breakpoint
|
||||
ALTER TABLE "user_stats" ALTER COLUMN "total_copilot_tokens" SET DATA TYPE bigint;
|
||||
14430
packages/db/migrations/meta/0181_snapshot.json
Normal file
14430
packages/db/migrations/meta/0181_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1261,6 +1261,13 @@
|
||||
"when": 1774305252055,
|
||||
"tag": "0180_amused_marvel_boy",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 181,
|
||||
"version": "7",
|
||||
"when": 1774411211528,
|
||||
"tag": "0181_dazzling_the_leader",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -753,7 +753,7 @@ export const userStats = pgTable('user_stats', {
|
||||
totalChatExecutions: integer('total_chat_executions').notNull().default(0),
|
||||
totalMcpExecutions: integer('total_mcp_executions').notNull().default(0),
|
||||
totalA2aExecutions: integer('total_a2a_executions').notNull().default(0),
|
||||
totalTokensUsed: integer('total_tokens_used').notNull().default(0),
|
||||
totalTokensUsed: bigint('total_tokens_used', { mode: 'number' }).notNull().default(0),
|
||||
totalCost: decimal('total_cost').notNull().default('0'),
|
||||
currentUsageLimit: decimal('current_usage_limit').default(DEFAULT_FREE_CREDITS.toString()), // Default $5 (1,000 credits) for free plan, null for team/enterprise
|
||||
usageLimitUpdatedAt: timestamp('usage_limit_updated_at').defaultNow(),
|
||||
@@ -769,7 +769,7 @@ export const userStats = pgTable('user_stats', {
|
||||
totalCopilotCost: decimal('total_copilot_cost').notNull().default('0'),
|
||||
currentPeriodCopilotCost: decimal('current_period_copilot_cost').notNull().default('0'),
|
||||
lastPeriodCopilotCost: decimal('last_period_copilot_cost').default('0'),
|
||||
totalCopilotTokens: integer('total_copilot_tokens').notNull().default(0),
|
||||
totalCopilotTokens: bigint('total_copilot_tokens', { mode: 'number' }).notNull().default(0),
|
||||
totalCopilotCalls: integer('total_copilot_calls').notNull().default(0),
|
||||
// MCP Copilot usage tracking
|
||||
totalMcpCopilotCalls: integer('total_mcp_copilot_calls').notNull().default(0),
|
||||
|
||||
Reference in New Issue
Block a user