mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-22 02:04:22 +01:00
chore: refactor db
This commit is contained in:
@@ -28,11 +28,9 @@ INSERT INTO files (
|
||||
session_id,
|
||||
path,
|
||||
content,
|
||||
version,
|
||||
created_at,
|
||||
updated_at
|
||||
version
|
||||
) VALUES (
|
||||
?, ?, ?, ?, ?, strftime('%s', 'now'), strftime('%s', 'now')
|
||||
?, ?, ?, ?, ?
|
||||
)
|
||||
RETURNING *;
|
||||
|
||||
@@ -41,7 +39,7 @@ UPDATE files
|
||||
SET
|
||||
content = ?,
|
||||
version = ?,
|
||||
updated_at = strftime('%s', 'now')
|
||||
updated_at = strftime('%Y-%m-%dT%H:%M:%f000Z', 'now')
|
||||
WHERE id = ?
|
||||
RETURNING *;
|
||||
|
||||
|
||||
@@ -5,15 +5,13 @@ INSERT INTO logs (
|
||||
timestamp,
|
||||
level,
|
||||
message,
|
||||
attributes,
|
||||
created_at
|
||||
attributes
|
||||
) VALUES (
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?
|
||||
) RETURNING *;
|
||||
|
||||
|
||||
@@ -21,11 +21,9 @@ INSERT INTO messages (
|
||||
session_id,
|
||||
role,
|
||||
parts,
|
||||
model,
|
||||
created_at,
|
||||
updated_at
|
||||
model
|
||||
) VALUES (
|
||||
?, ?, ?, ?, ?, strftime('%s', 'now'), strftime('%s', 'now')
|
||||
?, ?, ?, ?, ?
|
||||
)
|
||||
RETURNING *;
|
||||
|
||||
@@ -34,7 +32,7 @@ UPDATE messages
|
||||
SET
|
||||
parts = ?,
|
||||
finished_at = ?,
|
||||
updated_at = strftime('%s', 'now')
|
||||
updated_at = strftime('%Y-%m-%dT%H:%M:%f000Z', 'now')
|
||||
WHERE id = ?;
|
||||
|
||||
|
||||
|
||||
@@ -8,9 +8,7 @@ INSERT INTO sessions (
|
||||
completion_tokens,
|
||||
cost,
|
||||
summary,
|
||||
summarized_at,
|
||||
updated_at,
|
||||
created_at
|
||||
summarized_at
|
||||
) VALUES (
|
||||
?,
|
||||
?,
|
||||
@@ -20,9 +18,7 @@ INSERT INTO sessions (
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
strftime('%s', 'now'),
|
||||
strftime('%s', 'now')
|
||||
?
|
||||
) RETURNING *;
|
||||
|
||||
-- name: GetSessionByID :one
|
||||
|
||||
Reference in New Issue
Block a user