summaryrefslogtreecommitdiffhomepage
path: root/internal/db/sql/files.sql
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-05-29 15:41:13 -0500
committeradamdottv <[email protected]>2025-05-29 15:41:13 -0500
commit4818bc542611b3ab554824fece8a071b0ac6307b (patch)
treecddbdf77119ba15a86368a4027130baeb9ae333c /internal/db/sql/files.sql
parent8a8c6b14afe8edd71f19d1d6054e0eac51d4a3ae (diff)
downloadopencode-4818bc542611b3ab554824fece8a071b0ac6307b.tar.gz
opencode-4818bc542611b3ab554824fece8a071b0ac6307b.zip
wip: refactoring tui
Diffstat (limited to 'internal/db/sql/files.sql')
-rw-r--r--internal/db/sql/files.sql69
1 files changed, 0 insertions, 69 deletions
diff --git a/internal/db/sql/files.sql b/internal/db/sql/files.sql
deleted file mode 100644
index 560a6984f..000000000
--- a/internal/db/sql/files.sql
+++ /dev/null
@@ -1,69 +0,0 @@
--- name: GetFile :one
-SELECT *
-FROM files
-WHERE id = ? LIMIT 1;
-
--- name: GetFileByPathAndSession :one
-SELECT *
-FROM files
-WHERE path = ? AND session_id = ?
-ORDER BY created_at DESC
-LIMIT 1;
-
--- name: ListFilesBySession :many
-SELECT *
-FROM files
-WHERE session_id = ?
-ORDER BY created_at ASC;
-
--- name: ListFilesByPath :many
-SELECT *
-FROM files
-WHERE path = ?
-ORDER BY created_at DESC;
-
--- name: CreateFile :one
-INSERT INTO files (
- id,
- session_id,
- path,
- content,
- version
-) VALUES (
- ?, ?, ?, ?, ?
-)
-RETURNING *;
-
--- name: UpdateFile :one
-UPDATE files
-SET
- content = ?,
- version = ?,
- updated_at = strftime('%Y-%m-%dT%H:%M:%f000Z', 'now')
-WHERE id = ?
-RETURNING *;
-
--- name: DeleteFile :exec
-DELETE FROM files
-WHERE id = ?;
-
--- name: DeleteSessionFiles :exec
-DELETE FROM files
-WHERE session_id = ?;
-
--- name: ListLatestSessionFiles :many
-SELECT f.*
-FROM files f
-INNER JOIN (
- SELECT path, MAX(created_at) as max_created_at
- FROM files
- GROUP BY path
-) latest ON f.path = latest.path AND f.created_at = latest.max_created_at
-WHERE f.session_id = ?
-ORDER BY f.path;
-
--- name: ListNewFiles :many
-SELECT *
-FROM files
-WHERE is_new = 1
-ORDER BY created_at DESC;