summaryrefslogtreecommitdiffhomepage
path: root/internal/db
diff options
context:
space:
mode:
authorKujtim Hoxha <[email protected]>2025-04-16 20:06:23 +0200
committerKujtim Hoxha <[email protected]>2025-04-21 13:42:00 +0200
commitbbfa60c787f2ec459f1689b9a650ddbec9693ed9 (patch)
treef7f2aa31c460c8cc22ec40cc299c386277152241 /internal/db
parent76b4065f17b87a63092acfd98c997bab53700b35 (diff)
downloadopencode-bbfa60c787f2ec459f1689b9a650ddbec9693ed9.tar.gz
opencode-bbfa60c787f2ec459f1689b9a650ddbec9693ed9.zip
reimplement agent,provider and add file history
Diffstat (limited to 'internal/db')
-rw-r--r--internal/db/files.sql.go4
-rw-r--r--internal/db/sql/files.sql4
2 files changed, 6 insertions, 2 deletions
diff --git a/internal/db/files.sql.go b/internal/db/files.sql.go
index b45731098..39def271f 100644
--- a/internal/db/files.sql.go
+++ b/internal/db/files.sql.go
@@ -97,7 +97,9 @@ func (q *Queries) GetFile(ctx context.Context, id string) (File, error) {
const getFileByPathAndSession = `-- name: GetFileByPathAndSession :one
SELECT id, session_id, path, content, version, created_at, updated_at
FROM files
-WHERE path = ? AND session_id = ? LIMIT 1
+WHERE path = ? AND session_id = ?
+ORDER BY created_at DESC
+LIMIT 1
`
type GetFileByPathAndSessionParams struct {
diff --git a/internal/db/sql/files.sql b/internal/db/sql/files.sql
index c2e799076..aba2a6111 100644
--- a/internal/db/sql/files.sql
+++ b/internal/db/sql/files.sql
@@ -6,7 +6,9 @@ WHERE id = ? LIMIT 1;
-- name: GetFileByPathAndSession :one
SELECT *
FROM files
-WHERE path = ? AND session_id = ? LIMIT 1;
+WHERE path = ? AND session_id = ?
+ORDER BY created_at DESC
+LIMIT 1;
-- name: ListFilesBySession :many
SELECT *