mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-18 18:16:25 +00:00
Avoid touching session update time in data migration
This commit is contained in:
@@ -86,18 +86,17 @@ export const layer = Layer.effect(
|
||||
}
|
||||
|
||||
for (const [sessionID, value] of usageBySession) {
|
||||
db.update(SessionTable)
|
||||
.set({
|
||||
cost: value.cost,
|
||||
tokens_input: value.tokens.input,
|
||||
tokens_output: value.tokens.output,
|
||||
tokens_reasoning: value.tokens.reasoning,
|
||||
tokens_cache_read: value.tokens.cache.read,
|
||||
tokens_cache_write: value.tokens.cache.write,
|
||||
time_updated: sql`${SessionTable.time_updated}`,
|
||||
})
|
||||
.where(eq(SessionTable.id, sessionID))
|
||||
.run()
|
||||
db.run(sql`
|
||||
update ${SessionTable}
|
||||
set
|
||||
${SessionTable.cost} = ${value.cost},
|
||||
${SessionTable.tokens_input} = ${value.tokens.input},
|
||||
${SessionTable.tokens_output} = ${value.tokens.output},
|
||||
${SessionTable.tokens_reasoning} = ${value.tokens.reasoning},
|
||||
${SessionTable.tokens_cache_read} = ${value.tokens.cache.read},
|
||||
${SessionTable.tokens_cache_write} = ${value.tokens.cache.write}
|
||||
where ${SessionTable.id} = ${sessionID}
|
||||
`)
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user