From e7258e38aeb46281fda474b8b7fcc3eee35edd9f Mon Sep 17 00:00:00 2001
From: Kujtim Hoxha <kujtimii.h@gmail.com>
Date: Sun, 23 Mar 2025 22:25:31 +0100
Subject: initial agent setup

---
 internal/db/sql/messages.sql | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 internal/db/sql/messages.sql

(limited to 'internal/db/sql/messages.sql')

diff --git a/internal/db/sql/messages.sql b/internal/db/sql/messages.sql
new file mode 100644
index 000000000..db5e192fc
--- /dev/null
+++ b/internal/db/sql/messages.sql
@@ -0,0 +1,30 @@
+-- name: GetMessage :one
+SELECT *
+FROM messages
+WHERE id = ? LIMIT 1;
+
+-- name: ListMessagesBySession :many
+SELECT *
+FROM messages
+WHERE session_id = ?
+ORDER BY created_at ASC;
+
+-- name: CreateMessage :one
+INSERT INTO messages (
+    id,
+    session_id,
+    message_data,
+    created_at,
+    updated_at
+) VALUES (
+    ?, ?, ?, strftime('%s', 'now'), strftime('%s', 'now')
+)
+RETURNING *;
+
+-- name: DeleteMessage :exec
+DELETE FROM messages
+WHERE id = ?;
+
+-- name: DeleteSessionMessages :exec
+DELETE FROM messages
+WHERE session_id = ?;
-- 
cgit v1.2.3

