chore: mark lastRefreshAt field as deprecated in userCredit schema

This commit is contained in:
javayhu 2025-08-24 10:22:31 +08:00
parent 2d0392db61
commit 33fe00b8dc
2 changed files with 1 additions and 3 deletions

View File

@ -147,7 +147,6 @@ export async function addCredits({
.update(userCredit) .update(userCredit)
.set({ .set({
currentCredits: newBalance, currentCredits: newBalance,
// lastRefreshAt: new Date(), // NOTE: we can not update this field here
updatedAt: new Date(), updatedAt: new Date(),
}) })
.where(eq(userCredit.userId, userId)); .where(eq(userCredit.userId, userId));
@ -158,7 +157,6 @@ export async function addCredits({
id: randomUUID(), id: randomUUID(),
userId, userId,
currentCredits: newBalance, currentCredits: newBalance,
// lastRefreshAt: new Date(), // NOTE: we can not update this field here
createdAt: new Date(), createdAt: new Date(),
updatedAt: new Date(), updatedAt: new Date(),
}); });

View File

@ -94,7 +94,7 @@ export const userCredit = pgTable("user_credit", {
id: text("id").primaryKey(), id: text("id").primaryKey(),
userId: text("user_id").notNull().references(() => user.id, { onDelete: 'cascade' }), userId: text("user_id").notNull().references(() => user.id, { onDelete: 'cascade' }),
currentCredits: integer("current_credits").notNull().default(0), currentCredits: integer("current_credits").notNull().default(0),
lastRefreshAt: timestamp("last_refresh_at"), lastRefreshAt: timestamp("last_refresh_at"), // deprecated
createdAt: timestamp("created_at").notNull().defaultNow(), createdAt: timestamp("created_at").notNull().defaultNow(),
updatedAt: timestamp("updated_at").notNull().defaultNow(), updatedAt: timestamp("updated_at").notNull().defaultNow(),
}, (table) => ({ }, (table) => ({