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

View File

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