mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-11 01:03:40 +00:00
Avoid touching session update time in data migration
This commit is contained in:
parent
937a3c10b3
commit
f1e66751d5
1 changed files with 11 additions and 12 deletions
|
|
@ -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}
|
||||
`)
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue